Magic suggestions area (#772)

This commit is contained in:
alwx 2017-02-10 14:03:48 +03:00 committed by Roman Volosovskyi
parent ace355515a
commit 27ddb24f7b
2 changed files with 17 additions and 10 deletions

View File

@ -239,14 +239,11 @@
(register-sub :input-margin (register-sub :input-margin
(fn [] (fn []
(let [kb-height (subscribe [:get :keyboard-height]) (let [kb-height (subscribe [:get :keyboard-height])
focused (subscribe [:get :focused])
mode (subscribe [:kb-mode])
kb-max (subscribe [:get :keyboard-max-height]) kb-max (subscribe [:get :keyboard-max-height])
show-emoji? (subscribe [:chat-ui-props :show-emoji?])] show-emoji? (subscribe [:chat-ui-props :show-emoji?])]
(reaction (reaction
(cond @show-emoji? (or @kb-max c/emoji-container-height) (cond @show-emoji? (or @kb-max c/emoji-container-height)
ios? @kb-height ios? @kb-height
(and @focused (= :pan @mode) (pos? @kb-height)) 20
:else 0))))) :else 0)))))
(register-sub :max-layout-height (register-sub :max-layout-height

View File

@ -151,10 +151,20 @@
(when (seq suggestions) suggestions)) (when (seq suggestions) suggestions))
(defn response-view [] (defn response-view []
(let [response-height (anim/create-value c/input-height)] (let [response-height (anim/create-value c/input-height)
[container response-height command (subscribe [:get-chat-command])
[request-info response-height] suggestions (subscribe [:get-content-suggestions])
[suggestions-web-view] errors (subscribe [:validation-errors])
[response-suggestions-view] custom-errors (subscribe [:custom-validation-errors])]
[cv/validation-messages] (fn []
[placeholder]])) (when (or (:fullscreen @command)
(= :response (:type @command))
(seq @suggestions)
(seq @errors)
(seq @custom-errors))
[container response-height
[request-info response-height]
[suggestions-web-view]
[response-suggestions-view]
[cv/validation-messages]
[placeholder]]))))