Fix keyboard hiding. Focus on input when response view is shown.
Former-commit-id: df8c7f2fe7
This commit is contained in:
parent
f4a1d332f2
commit
d65584bd3b
|
@ -78,6 +78,23 @@
|
||||||
:handler (:handler command)}]
|
:handler (:handler command)}]
|
||||||
(commands/stage-command db command-info))))
|
(commands/stage-command db command-info))))
|
||||||
|
|
||||||
|
(register-handler :set-message-input []
|
||||||
|
(fn [db [_ input]]
|
||||||
|
(assoc db :message-input input)))
|
||||||
|
|
||||||
|
(register-handler :prepare-message-input
|
||||||
|
(u/side-effect!
|
||||||
|
(fn [db _]
|
||||||
|
(when-let [message-input (:message-input db)]
|
||||||
|
(.clear message-input)
|
||||||
|
(.focus message-input)))))
|
||||||
|
|
||||||
|
(register-handler :blur-message-input
|
||||||
|
(u/side-effect!
|
||||||
|
(fn [db _]
|
||||||
|
(when-let [message-input (:message-input db)]
|
||||||
|
(.blur message-input)))))
|
||||||
|
|
||||||
(register-handler :set-response-chat-command
|
(register-handler :set-response-chat-command
|
||||||
(after #(dispatch [:animate-show-response]))
|
(after #(dispatch [:animate-show-response]))
|
||||||
(fn [db [_ to-msg-id command-key]]
|
(fn [db [_ to-msg-id command-key]]
|
||||||
|
|
|
@ -15,16 +15,16 @@
|
||||||
(assoc-in db [:animations :commands-input-is-switching?] false)))
|
(assoc-in db [:animations :commands-input-is-switching?] false)))
|
||||||
|
|
||||||
(register-handler :animate-cancel-command
|
(register-handler :animate-cancel-command
|
||||||
(path :animations)
|
(path :animations)
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(if-not (:commands-input-is-switching? db)
|
(if-not (:commands-input-is-switching? db)
|
||||||
(assoc db
|
(assoc db
|
||||||
:commands-input-is-switching? true
|
:commands-input-is-switching? true
|
||||||
:message-input-buttons-scale 1
|
:message-input-buttons-scale 1
|
||||||
:message-input-offset 0
|
:message-input-offset 0
|
||||||
:to-response-height zero-height
|
:to-response-height zero-height
|
||||||
:messages-offset 0)
|
:messages-offset 0)
|
||||||
db)))
|
db)))
|
||||||
|
|
||||||
(register-handler :finish-animate-response-resize
|
(register-handler :finish-animate-response-resize
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
|
@ -56,12 +56,13 @@
|
||||||
(assoc-in db [:animations :to-response-height] (get-response-height db)))
|
(assoc-in db [:animations :to-response-height] (get-response-height db)))
|
||||||
|
|
||||||
(register-handler :finish-show-response
|
(register-handler :finish-show-response
|
||||||
|
(after #(dispatch [:prepare-message-input]))
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(assoc-in db [:animations :commands-input-is-switching?] false)))
|
(assoc-in db [:animations :commands-input-is-switching?] false)))
|
||||||
|
|
||||||
(register-handler :animate-show-response
|
(register-handler :animate-show-response
|
||||||
|
(after #(dispatch [:animate-response-resize]))
|
||||||
(fn [db _]
|
(fn [db _]
|
||||||
(dispatch [:animate-response-resize])
|
|
||||||
(-> db
|
(-> db
|
||||||
(assoc-in [:animations :commands-input-is-switching?] true)
|
(assoc-in [:animations :commands-input-is-switching?] true)
|
||||||
(assoc-in [:animations :response-height-current] zero-height)
|
(assoc-in [:animations :response-height-current] zero-height)
|
||||||
|
|
|
@ -146,19 +146,22 @@
|
||||||
message-input? st/message-input
|
message-input? st/message-input
|
||||||
response? st-response/command-input
|
response? st-response/command-input
|
||||||
command st-command/command-input)
|
command st-command/command-input)
|
||||||
|
:ref (fn [input]
|
||||||
|
(dispatch [:set-message-input input]))
|
||||||
:autoFocus false
|
:autoFocus false
|
||||||
:blurOnSubmit dismiss-keyboard
|
:blurOnSubmit dismiss-keyboard
|
||||||
:onChangeText (fn [text]
|
:onChangeText (fn [text]
|
||||||
((if message-input?
|
(when-not animation?
|
||||||
set-input-message
|
((if message-input?
|
||||||
command/set-input-message)
|
set-input-message
|
||||||
text))
|
command/set-input-message)
|
||||||
:editable (not animation?)
|
text)))
|
||||||
:onSubmitEditing #(if message-input?
|
:onSubmitEditing #(when-not animation?
|
||||||
(try-send staged-commands
|
(if message-input?
|
||||||
input-message
|
(try-send staged-commands
|
||||||
dismiss-keyboard)
|
input-message
|
||||||
(command/try-send input-command validator))}
|
dismiss-keyboard)
|
||||||
|
(command/try-send input-command validator)))}
|
||||||
(when command
|
(when command
|
||||||
{:accessibility-label :command-input})
|
{:accessibility-label :command-input})
|
||||||
input-options)
|
input-options)
|
||||||
|
|
Loading…
Reference in New Issue