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.chat.views.input.utils :as input-utils]
[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?
(defn enough-dy [gesture]
(> (Math/abs (.-dy gesture)) 10))
(defn on-move [response-height layout-height]
(fn [_ gesture]
(when (enough-dy gesture)
(let [to-value (- @layout-height (.-moveY gesture))]
(when (> to-value input-utils/min-height)
(dispatch [:set :expandable-view-height-to-value to-value])
(anim/start
(anim/spring response-height {:toValue to-value})))))))
(let [margin-top (+ (get-in p/platform-specific [:component-styles :status-bar :main :height])
(/ (:height toolbar-st/toolbar) 2))]
(fn [_ gesture]
(when (enough-dy gesture)
(let [to-value (+ (- @layout-height (.-moveY gesture)) margin-top)]
(when (> to-value input-utils/min-height)
(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]
(fn [_ gesture]