From a17c00398ba631a174aee5184d3ad34abddbc2cb Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Wed, 3 May 2017 14:20:22 +0300 Subject: [PATCH] fixes https://github.com/status-im/status-react/issues/1111 --- src/status_im/chat/views/input/input.cljs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/status_im/chat/views/input/input.cljs b/src/status_im/chat/views/input/input.cljs index 94a38d9deb..dcc4b76442 100644 --- a/src/status_im/chat/views/input/input.cljs +++ b/src/status_im/chat/views/input/input.cljs @@ -64,16 +64,19 @@ (let [input-text (subscribe [:chat :input-text]) command (subscribe [:selected-chat-command]) sending-in-progress? (subscribe [:chat-ui-props :sending-in-progress?]) - input-focused? (subscribe [:chat-ui-props :input-focused?])] + input-focused? (subscribe [:chat-ui-props :input-focused?]) + input-ref (atom nil)] (fn [{:keys [set-layout-height set-container-width height]}] [text-input {:ref #(when % - (dispatch [:set-chat-ui-props {:input-ref %}])) + (dispatch [:set-chat-ui-props {:input-ref %}]) + (reset! input-ref %)) :accessibility-label id/chat-message-input :multiline true :default-value (or @input-text "") :editable true :blur-on-submit false + :on-submit-editing #(.setNativeProps @input-ref (clj->js {:text (str @input-text "\n")})) ;because of bug on Android, next line is not inserted :on-focus #(dispatch [:set-chat-ui-props {:input-focused? true :show-emoji? false}]) :on-blur #(do (dispatch [:set-chat-ui-props {:input-focused? false}]))