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