From 23b90af0641ee9f0256bd2f0b569dadfe9233b1b Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Mon, 20 Jun 2016 21:26:57 +0300 Subject: [PATCH] abit more refactoring Former-commit-id: 9179cc61b45dd5c42a496cafdcb46ef411150758 --- src/status_im/chat/views/message_input.cljs | 33 +++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/status_im/chat/views/message_input.cljs b/src/status_im/chat/views/message_input.cljs index 67310f8a77..4a63d6cba5 100644 --- a/src/status_im/chat/views/message_input.cljs +++ b/src/status_im/chat/views/message_input.cljs @@ -34,25 +34,28 @@ (defn message-input-container [input] [view st/message-input-container input]) +(def plain-input-options + {:style st-message/message-input + :onChangeText plain-message/set-input-message + :onSubmitEditing plain-message/send}) + +(def command-input-options + {:style st-response/command-input + :onChangeText command/set-input-message + :onSubmitEditing command/send-command}) + (defview message-input [input-options] [command? [:animations :command?] input-message [:get-chat-input-text] input-command [:get-chat-command-content]] - [text-input (merge {:style (if command? - st-response/command-input - st-message/message-input) - :ref #(dispatch [:set-message-input %]) - :autoFocus false - :blurOnSubmit false - :onChangeText (if command? - command/set-input-message - plain-message/set-input-message) - :onSubmitEditing (if command? - command/send-command - plain-message/send)} - (when command? - {:accessibility-label :command-input}) - input-options) + [text-input (merge + (if command? + command-input-options + plain-input-options) + {:autoFocus false + :blurOnSubmit false + :accessibility-label :input} + input-options) (if command? input-command input-message)]) (defview plain-message-input-view [{:keys [input-options validator]}]