parent
59a9a63fb8
commit
887dc44fc8
|
@ -1,7 +1,8 @@
|
|||
(ns status-im.chat.styles.input.input
|
||||
(:require-macros [status-im.utils.styles :refer [defnstyle]])
|
||||
(:require [status-im.components.styles :as common]
|
||||
[status-im.utils.platform :as platform]))
|
||||
[status-im.utils.platform :as platform]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(def color-root-border "rgba(192, 198, 202, 0.28)")
|
||||
(def color-root-border-android "#e8eaeb")
|
||||
|
@ -41,7 +42,7 @@
|
|||
:background-color color-input
|
||||
:flex-direction :row
|
||||
:flex-grow 1
|
||||
:height (+ (min (max min-input-height content-height) max-input-height) 0)
|
||||
:height (min (max min-input-height content-height) max-input-height)
|
||||
:margin-top anim-margin
|
||||
:padding-left 10
|
||||
:padding-right 10
|
||||
|
@ -53,8 +54,7 @@
|
|||
:font-size 14
|
||||
:padding-top input-spacing-top
|
||||
:padding-bottom input-spacing-bottom
|
||||
:line-height 20
|
||||
:android {:min-height content-height}})
|
||||
:height (min (max min-input-height content-height) max-input-height)})
|
||||
|
||||
(def invisible-input-text
|
||||
{:font-size 14
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
(defview commands-view []
|
||||
[commands [:chat :command-suggestions]
|
||||
requests [:chat :request-suggestions]
|
||||
show-suggestions? [:show-suggestions?]]
|
||||
[view style/commands-root
|
||||
[view style/command-list-icon-container
|
||||
|
@ -47,10 +48,15 @@
|
|||
[scroll-view {:horizontal true
|
||||
:showsHorizontalScrollIndicator false
|
||||
:keyboardShouldPersistTaps true}
|
||||
[view style/commands
|
||||
(for [[index [command-key command]] (map-indexed vector commands)]
|
||||
^{:key command-key}
|
||||
[command-view index command])]]])
|
||||
(let [commands (map-indexed vector commands)
|
||||
requests (map-indexed vector requests)]
|
||||
[view style/commands
|
||||
(for [[index [command-key command]] commands]
|
||||
^{:key command-key}
|
||||
[command-view index command])
|
||||
(for [[index command] requests]
|
||||
^{:key (str "request-" index)}
|
||||
[command-view index command])])]])
|
||||
|
||||
(defn- basic-text-input [_]
|
||||
(let [input-text (subscribe [:chat :input-text])
|
||||
|
@ -60,24 +66,22 @@
|
|||
[text-input
|
||||
{:ref #(dispatch [:set-chat-ui-props :input-ref %])
|
||||
:accessibility-label id/chat-message-input
|
||||
:blur-on-submit true
|
||||
:blur-on-submit false
|
||||
:multiline true
|
||||
:default-value (or @input-text "")
|
||||
:editable (not @sending-in-progress?)
|
||||
:on-blur #(do (dispatch [:set-chat-ui-props :input-focused? false])
|
||||
(set-layout-height 0))
|
||||
:on-change-text #(if-not (str/includes? % "\n")
|
||||
(do (dispatch [:set-chat-input-text %])
|
||||
(dispatch [:load-chat-parameter-box (:command @command)])
|
||||
(when (not @command)
|
||||
(dispatch [:set-chat-input-metadata nil])
|
||||
(dispatch [:set-chat-ui-props :result-box nil]))
|
||||
(dispatch [:set-chat-ui-props :validation-messages nil]))
|
||||
(dispatch [:send-current-message]))
|
||||
:on-content-size-change #(let [h (-> (.-nativeEvent %)
|
||||
:on-change #(let [h (-> (.-nativeEvent %)
|
||||
(.-contentSize)
|
||||
(.-height))]
|
||||
(set-layout-height h))
|
||||
:on-change-text #(do (dispatch [:set-chat-input-text %])
|
||||
(dispatch [:load-chat-parameter-box (:command @command)])
|
||||
(when (not @command)
|
||||
(dispatch [:set-chat-input-metadata nil])
|
||||
(dispatch [:set-chat-ui-props :result-box nil]))
|
||||
(dispatch [:set-chat-ui-props :validation-messages nil]))
|
||||
:on-selection-change #(let [s (-> (.-nativeEvent %)
|
||||
(.-selection))]
|
||||
(when (and (= (.-end s) (+ 2 (count (get-in @command [:command :name]))))
|
||||
|
|
Loading…
Reference in New Issue