improvement of suggestions animation

This commit is contained in:
Roman Volosovskyi 2016-07-02 12:05:42 +03:00
parent e73e9ee7b6
commit 32a7821da9
2 changed files with 7 additions and 4 deletions

View File

@ -14,7 +14,8 @@
[status-im.chat.styles.response :as st] [status-im.chat.styles.response :as st]
[status-im.chat.styles.dragdown :as ddst] [status-im.chat.styles.dragdown :as ddst]
[status-im.components.animation :as anim] [status-im.components.animation :as anim]
[status-im.chat.suggestions-responder :as resp])) [status-im.chat.suggestions-responder :as resp]
[status-im.chat.constants :as c]))
(defn drag-icon [] (defn drag-icon []
[view st/drag-container [view st/drag-container
@ -58,7 +59,8 @@
(defn container-animation-logic [{:keys [to-value val]}] (defn container-animation-logic [{:keys [to-value val]}]
(let [to-value @to-value] (let [to-value @to-value]
(anim/start (anim/spring val {:toValue to-value})))) (when-not (= to-value (.-_value val))
(anim/start (anim/spring val {:toValue 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
@ -89,7 +91,7 @@
(when (seq suggestions) suggestions)) (when (seq suggestions) suggestions))
(defn response-view [] (defn response-view []
(let [response-height (anim/create-value 0)] (let [response-height (anim/create-value c/input-height)]
[container response-height [container response-height
[request-info response-height] [request-info response-height]
[response-suggestions-view] [response-suggestions-view]

View File

@ -98,7 +98,8 @@
(defn container-animation-logic [{:keys [to-value val]}] (defn container-animation-logic [{:keys [to-value val]}]
(when-let [to-value @to-value] (when-let [to-value @to-value]
(anim/start (anim/spring val {:toValue to-value})))) (when-not (= to-value (.-_value val))
(anim/start (anim/spring val {:toValue 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