Andrey Shovkoplyas 2017-05-04 13:57:40 +03:00 committed by Roman Volosovskyi
parent bdd2c3aa14
commit 52c10562dc
1 changed files with 12 additions and 8 deletions

View File

@ -3,20 +3,24 @@
[status-im.components.animation :as anim] [status-im.components.animation :as anim]
[status-im.chat.views.input.utils :as input-utils] [status-im.chat.views.input.utils :as input-utils]
[re-frame.core :refer [dispatch]] [re-frame.core :refer [dispatch]]
[taoensso.timbre :as log])) [taoensso.timbre :as log]
[status-im.utils.platform :as p]
[status-im.components.toolbar-new.styles :as toolbar-st]))
;; todo bad name. Ideas? ;; todo bad name. Ideas?
(defn enough-dy [gesture] (defn enough-dy [gesture]
(> (Math/abs (.-dy gesture)) 10)) (> (Math/abs (.-dy gesture)) 10))
(defn on-move [response-height layout-height] (defn on-move [response-height layout-height]
(fn [_ gesture] (let [margin-top (+ (get-in p/platform-specific [:component-styles :status-bar :main :height])
(when (enough-dy gesture) (/ (:height toolbar-st/toolbar) 2))]
(let [to-value (- @layout-height (.-moveY gesture))] (fn [_ gesture]
(when (> to-value input-utils/min-height) (when (enough-dy gesture)
(dispatch [:set :expandable-view-height-to-value to-value]) (let [to-value (+ (- @layout-height (.-moveY gesture)) margin-top)]
(anim/start (when (> to-value input-utils/min-height)
(anim/spring response-height {:toValue to-value}))))))) (dispatch [:set :expandable-view-height-to-value to-value])
(anim/start
(anim/spring response-height {:toValue to-value}))))))))
(defn on-release [response-height handler-name key] (defn on-release [response-height handler-name key]
(fn [_ gesture] (fn [_ gesture]