From 5065dd6afb087195fbbbc0f52ac908015e37e13d Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Sat, 2 Jul 2016 12:05:42 +0300 Subject: [PATCH] improvement of suggestions animation Former-commit-id: 32a7821da9ac8c6040fc3227f6cf7eaeebfd2dc2 --- src/status_im/chat/views/response.cljs | 8 +++++--- src/status_im/chat/views/suggestions.cljs | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/status_im/chat/views/response.cljs b/src/status_im/chat/views/response.cljs index eaad55d093..a0d8e876bc 100644 --- a/src/status_im/chat/views/response.cljs +++ b/src/status_im/chat/views/response.cljs @@ -14,7 +14,8 @@ [status-im.chat.styles.response :as st] [status-im.chat.styles.dragdown :as ddst] [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 [] [view st/drag-container @@ -58,7 +59,8 @@ (defn container-animation-logic [{:keys [to-value val]}] (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] (let [;; todo to-response-height, cur-response-height must be specific @@ -89,7 +91,7 @@ (when (seq suggestions) suggestions)) (defn response-view [] - (let [response-height (anim/create-value 0)] + (let [response-height (anim/create-value c/input-height)] [container response-height [request-info response-height] [response-suggestions-view] diff --git a/src/status_im/chat/views/suggestions.cljs b/src/status_im/chat/views/suggestions.cljs index ca2bd8d0fe..909641d829 100644 --- a/src/status_im/chat/views/suggestions.cljs +++ b/src/status_im/chat/views/suggestions.cljs @@ -98,7 +98,8 @@ (defn container-animation-logic [{:keys [to-value val]}] (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] (let [;; todo to-response-height, cur-response-height must be specific