Skip to content

Commit

Permalink
Adjusted chat input to send text on on-submit-editing
Browse files Browse the repository at this point in the history
Signed-off-by: Volodymyr Kozieiev <[email protected]>
  • Loading branch information
vkjr committed Oct 25, 2018
1 parent f8ef431 commit 0bc9fb6
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/status_im/ui/screens/desktop/main/chat/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,10 @@
:ref #(reset! inp-ref %)
:default-value input-text
:on-content-size-change #(set-container-height-fn (.-height (.-contentSize (.-nativeEvent %))))
:on-key-press (fn [e]
(let [native-event (.-nativeEvent e)
key (.-key native-event)
modifiers (js->clj (.-modifiers native-event))
should-send (and (= key "Enter") (not (contains? (set modifiers) "shift")))]
(when should-send
(.clear @inp-ref)
(.focus @inp-ref)
(re-frame/dispatch [:chat.ui/send-current-message]))))
:submit-shortcut {:key "Enter"}
:on-submit-editing #(do (.clear @inp-ref)
(.focus @inp-ref)
(re-frame/dispatch [:chat.ui/send-current-message]))
:on-change (fn [e]
(let [native-event (.-nativeEvent e)
text (.-text native-event)]
Expand Down

0 comments on commit 0bc9fb6

Please sign in to comment.