Keep the keyboard open after message sending
This commit is contained in:
parent
7459b63251
commit
b216d7624a
|
@ -6,8 +6,7 @@
|
|||
animated-view
|
||||
icon
|
||||
touchable-highlight
|
||||
text-input
|
||||
dismiss-keyboard!]]
|
||||
text-input]]
|
||||
[status-im.components.animation :as anim]
|
||||
[status-im.chat.views.plain-message :as plain-message]
|
||||
[status-im.chat.views.command :as command]
|
||||
|
@ -61,8 +60,7 @@
|
|||
staged-commands [:get-chat-staged-commands]
|
||||
typing-command? [:typing-command?]
|
||||
commands-input-is-switching? [:animations :commands-input-is-switching?]]
|
||||
(let [dismiss-keyboard (not (or command typing-command?))
|
||||
response? (and command to-msg-id)
|
||||
(let [response? (and command to-msg-id)
|
||||
message-input? (or (not command) commands-input-is-switching?)
|
||||
animation? commands-input-is-switching?]
|
||||
[text-input (merge {:style (cond
|
||||
|
@ -72,7 +70,7 @@
|
|||
:ref (fn [input]
|
||||
(dispatch [:set-message-input input]))
|
||||
:autoFocus false
|
||||
:blurOnSubmit dismiss-keyboard
|
||||
:blurOnSubmit false
|
||||
:onChangeText (fn [text]
|
||||
(when-not animation?
|
||||
((if message-input?
|
||||
|
@ -82,8 +80,7 @@
|
|||
:onSubmitEditing #(when-not animation?
|
||||
(if message-input?
|
||||
(plain-message/try-send staged-commands
|
||||
input-message
|
||||
dismiss-keyboard)
|
||||
input-message)
|
||||
(command/try-send input-command validator)))}
|
||||
(when command
|
||||
{:accessibility-label :command-input})
|
||||
|
@ -100,8 +97,7 @@
|
|||
staged-commands [:get-chat-staged-commands]
|
||||
typing-command? [:typing-command?]
|
||||
commands-input-is-switching? [:animations :commands-input-is-switching?]]
|
||||
(let [dismiss-keyboard (not (or command typing-command?))
|
||||
response? (and command to-msg-id)
|
||||
(let [response? (and command to-msg-id)
|
||||
message-input? (or (not command) commands-input-is-switching?)]
|
||||
[view st/input-container
|
||||
[view st/input-view
|
||||
|
@ -117,8 +113,7 @@
|
|||
(if message-input?
|
||||
(when (plain-message/message-valid? staged-commands input-message)
|
||||
[send-button {:on-press #(plain-message/try-send staged-commands
|
||||
input-message
|
||||
dismiss-keyboard)
|
||||
input-message)
|
||||
:accessibility-label :send-message}])
|
||||
(if (command/valid? input-command validator)
|
||||
[send-button {:on-press command/send-command
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
[status-im.components.react :refer [view
|
||||
animated-view
|
||||
icon
|
||||
touchable-highlight
|
||||
dismiss-keyboard!]]
|
||||
touchable-highlight]]
|
||||
[status-im.components.animation :as anim]
|
||||
[status-im.chat.styles.plain-message :as st]
|
||||
[status-im.constants :refer [response-input-hiding-duration]]))
|
||||
|
@ -14,19 +13,14 @@
|
|||
(defn set-input-message [message]
|
||||
(dispatch [:set-chat-input-text message]))
|
||||
|
||||
(defn send [dismiss-keyboard]
|
||||
(when dismiss-keyboard
|
||||
(dismiss-keyboard!))
|
||||
(dispatch [:send-chat-msg]))
|
||||
|
||||
(defn message-valid? [staged-commands message]
|
||||
(or (and (pos? (count message))
|
||||
(not= "!" message))
|
||||
(pos? (count staged-commands))))
|
||||
|
||||
(defn try-send [staged-commands message dismiss-keyboard]
|
||||
(defn try-send [staged-commands message]
|
||||
(when (message-valid? staged-commands message)
|
||||
(send dismiss-keyboard)))
|
||||
(dispatch [:send-chat-msg])))
|
||||
|
||||
(defn prepare-message-input [message-input]
|
||||
(when message-input
|
||||
|
|
Loading…
Reference in New Issue