Browse input in a wrong place (#384)
This commit is contained in:
parent
df9600525c
commit
727c6e23ca
|
@ -168,8 +168,7 @@
|
|||
(fn [{:keys [current-chat-id chats]} [_ height]]
|
||||
(let [{:keys [staged-scroll-view staged-scroll-height]} (get chats current-chat-id)]
|
||||
(when staged-scroll-view
|
||||
(let [y (if (and (> staged-scroll-height 0)
|
||||
(< staged-scroll-height height))
|
||||
(let [y (if (< 0 staged-scroll-height height)
|
||||
(- height staged-scroll-height)
|
||||
0)]
|
||||
(.scrollTo staged-scroll-view (clj->js {:x 0 :y y}))))))))
|
||||
|
|
|
@ -49,13 +49,13 @@
|
|||
:opacity 0.69
|
||||
:color color-white})
|
||||
|
||||
(defn response-view [keyboard-height height staged-commands]
|
||||
(defn response-view [height input-margin staged-commands]
|
||||
{:flexDirection :column
|
||||
:position :absolute
|
||||
:elevation (if (seq staged-commands) 5 4)
|
||||
:left 0
|
||||
:right 0
|
||||
:bottom keyboard-height
|
||||
:bottom input-margin
|
||||
:height height
|
||||
:backgroundColor color-white})
|
||||
|
||||
|
|
|
@ -251,19 +251,11 @@
|
|||
(register-sub :input-margin
|
||||
(fn []
|
||||
(let [kb-height (subscribe [:get :keyboard-height])
|
||||
command (subscribe [:get-chat-command])
|
||||
focused (subscribe [:get :focused])
|
||||
mode (subscribe [:kb-mode])]
|
||||
(reaction
|
||||
(cond (or ios?
|
||||
(and (not @focused)
|
||||
(= :on-send (keyword (:suggestions-trigger @command)))
|
||||
(pos? @kb-height)))
|
||||
@kb-height
|
||||
|
||||
(and @focused (= :pan @mode) (pos? @kb-height))
|
||||
20
|
||||
|
||||
(cond ios? @kb-height
|
||||
(and @focused (= :pan @mode) (pos? @kb-height)) 20
|
||||
:else 0)))))
|
||||
|
||||
(register-sub :max-layout-height
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
[status-im.utils.platform :refer [ios?]]
|
||||
[status-im.components.webview-bridge :refer [webview-bridge]]
|
||||
[status-im.i18n :refer [label]]
|
||||
[status-im.utils.datetime :as dt]))
|
||||
[status-im.utils.datetime :as dt]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn drag-icon []
|
||||
[view st/drag-container
|
||||
|
@ -52,7 +53,7 @@
|
|||
(dt/format-date "HH:mm" added))])])
|
||||
|
||||
(defn request-info [response-height]
|
||||
(let [layout-height (subscribe [:get :layout-height])
|
||||
(let [layout-height (subscribe [:max-layout-height :default])
|
||||
pan-responder (resp/pan-responder response-height
|
||||
layout-height
|
||||
:fix-response-height)
|
||||
|
@ -74,19 +75,21 @@
|
|||
|
||||
(defn container-animation-logic [{:keys [to-value val animate?]}]
|
||||
(when-let [to-value @to-value]
|
||||
(when-not (= to-value (.-_value val))
|
||||
(if (or (nil? @animate?) @animate?)
|
||||
(anim/start (anim/timing val {:toValue to-value
|
||||
:duration 300}))
|
||||
(anim/set-value val to-value)))))
|
||||
(let [max-layout-height (subscribe [:max-layout-height :default])
|
||||
to-value (min to-value (max 0 @max-layout-height))]
|
||||
(when-not (= to-value (.-_value val))
|
||||
(if (or (nil? @animate?) @animate?)
|
||||
(anim/start (anim/timing val {:toValue to-value
|
||||
:duration 300}))
|
||||
(anim/set-value val to-value))))))
|
||||
|
||||
(defn container [response-height & children]
|
||||
(let [;; todo to-response-height, cur-response-height must be specific
|
||||
;; for each chat
|
||||
to-response-height (subscribe [:response-height :default])
|
||||
input-margin (subscribe [:input-margin])
|
||||
changed (subscribe [:animations :response-height-changed])
|
||||
animate? (subscribe [:animate?])
|
||||
keyboard-height (subscribe [:get :keyboard-height])
|
||||
staged-commands (subscribe [:get-chat-staged-commands])
|
||||
context {:to-value to-response-height
|
||||
:val response-height
|
||||
|
@ -101,8 +104,8 @@
|
|||
(fn [response-height & children]
|
||||
@to-response-height @changed
|
||||
(into [animated-view {:style (st/response-view
|
||||
(if ios? @keyboard-height 0)
|
||||
response-height
|
||||
@input-margin
|
||||
@staged-commands)}]
|
||||
children))})))
|
||||
|
||||
|
|
|
@ -101,10 +101,12 @@
|
|||
|
||||
(defn container-animation-logic [{:keys [to-value val animate?]}]
|
||||
(when-let [to-value @to-value]
|
||||
(when-not (= to-value (.-_value val))
|
||||
(if (or (nil? @animate?) @animate?)
|
||||
(anim/start (anim/spring val {:toValue to-value}))
|
||||
(anim/set-value val to-value)))))
|
||||
(let [max-layout-height (subscribe [:max-layout-height :default])
|
||||
to-value (min to-value (max 0 @max-layout-height))]
|
||||
(when-not (= to-value (.-_value val))
|
||||
(if (or (nil? @animate?) @animate?)
|
||||
(anim/start (anim/spring val {:toValue to-value}))
|
||||
(anim/set-value val to-value))))))
|
||||
|
||||
(defn container [h & elements]
|
||||
(let [;; todo to-response-height, cur-response-height must be specific
|
||||
|
|
Loading…
Reference in New Issue