Input field takes 3 lines for 1-line browse command [webview-command-actions] (#1155)

This commit is contained in:
alwx 2017-05-04 14:39:43 +03:00 committed by Roman Volosovskyi
parent ff59f8a375
commit bdd2c3aa14
2 changed files with 6 additions and 4 deletions

View File

@ -53,12 +53,14 @@
:width container-width :width container-width
:height min-input-height}) :height min-input-height})
(defnstyle input-view [content-height] (defnstyle input-view [content-height single-line-input?]
{:flex 1 {:flex 1
:font-size 14 :font-size 14
:padding-top 5 :padding-top 5
:padding-bottom 5 :padding-bottom 5
:height (+ (min (max min-input-height content-height) max-input-height)) :height (if single-line-input?
min-input-height
(+ (min (max min-input-height content-height) max-input-height)))
:android {:padding-top 3}}) :android {:padding-top 3}})
(def invisible-input-text (def invisible-input-text

View File

@ -79,7 +79,7 @@
:show-emoji? false}]) :show-emoji? false}])
:on-blur #(do (dispatch [:set-chat-ui-props {:input-focused? false}])) :on-blur #(do (dispatch [:set-chat-ui-props {:input-focused? false}]))
:on-submit-editing (fn [e] :on-submit-editing (fn [e]
(when single-line-input? (if single-line-input?
(dispatch [:send-current-message]) (dispatch [:send-current-message])
(.setNativeProps @input-ref (clj->js {:text (str @input-text "\n")})))) (.setNativeProps @input-ref (clj->js {:text (str @input-text "\n")}))))
:on-layout (fn [e] :on-layout (fn [e]
@ -111,7 +111,7 @@
(when (and (= (.-end s) (+ 2 (count (get-in @command [:command :name])))) (when (and (= (.-end s) (+ 2 (count (get-in @command [:command :name]))))
(get-in @command [:command :sequential-params])) (get-in @command [:command :sequential-params]))
(dispatch [:chat-input-focus :seq-input-ref]))) (dispatch [:chat-input-focus :seq-input-ref])))
:style (style/input-view height) :style (style/input-view height single-line-input?)
:placeholder-text-color style/color-input-helper-placeholder :placeholder-text-color style/color-input-helper-placeholder
:auto-capitalize :sentences}]))) :auto-capitalize :sentences}])))