abit more refactoring

Former-commit-id: 9179cc61b4
This commit is contained in:
Roman Volosovskyi 2016-06-20 21:26:57 +03:00
parent 9e72e52737
commit 23b90af064
1 changed files with 18 additions and 15 deletions

View File

@ -34,25 +34,28 @@
(defn message-input-container [input] (defn message-input-container [input]
[view st/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] (defview message-input [input-options]
[command? [:animations :command?] [command? [:animations :command?]
input-message [:get-chat-input-text] input-message [:get-chat-input-text]
input-command [:get-chat-command-content]] input-command [:get-chat-command-content]]
[text-input (merge {:style (if command? [text-input (merge
st-response/command-input (if command?
st-message/message-input) command-input-options
:ref #(dispatch [:set-message-input %]) plain-input-options)
:autoFocus false {:autoFocus false
:blurOnSubmit false :blurOnSubmit false
:onChangeText (if command? :accessibility-label :input}
command/set-input-message input-options)
plain-message/set-input-message)
:onSubmitEditing (if command?
command/send-command
plain-message/send)}
(when command?
{:accessibility-label :command-input})
input-options)
(if command? input-command input-message)]) (if command? input-command input-message)])
(defview plain-message-input-view [{:keys [input-options validator]}] (defview plain-message-input-view [{:keys [input-options validator]}]