From cb03a563d1e3230cd6144919a71edd2f3841e551 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Thu, 30 Jun 2016 19:27:42 +0300 Subject: [PATCH] another attempt to improve animation Former-commit-id: 5ff4ff7ead38cb24279de455fa6d857f318074fe --- src/status_im/chat/handlers/animation.cljs | 8 ++++---- src/status_im/chat/views/suggestions.cljs | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/status_im/chat/handlers/animation.cljs b/src/status_im/chat/handlers/animation.cljs index 571297542b..c14a22b22d 100644 --- a/src/status_im/chat/handlers/animation.cljs +++ b/src/status_im/chat/handlers/animation.cljs @@ -29,10 +29,10 @@ (fn [{:keys [current-chat-id] :as db} _] (let [suggestions? (seq (get-in db [:command-suggestions current-chat-id])) current (get-in db [:animations :command-suggestions-height]) - height (if suggestions? middle-height 30) + height (if suggestions? middle-height input-height) changed? (if (and suggestions? (not (nil? current)) - (not= 30 current)) + (not= input-height current)) identity inc)] (-> db (update :animations assoc :command-suggestions-height height) @@ -44,7 +44,7 @@ type (get-in db path)] (if (= :response type) minimum-suggestion-height - 30))) + input-height))) (register-handler :animate-show-response [(after #(dispatch [:command-edit-mode]))] @@ -97,7 +97,7 @@ (let [suggestions (get-in db [:command-suggestions current-chat-id])] (if (seq suggestions) minimum-command-suggestions-height - 0.1))) + input-height))) (register-handler :fix-commands-suggestions-height (fix-height :command-suggestions-height diff --git a/src/status_im/chat/views/suggestions.cljs b/src/status_im/chat/views/suggestions.cljs index 457c441083..ca2bd8d0fe 100644 --- a/src/status_im/chat/views/suggestions.cljs +++ b/src/status_im/chat/views/suggestions.cljs @@ -115,14 +115,12 @@ on-update :reagent-render (fn [h & elements] - @changed + @to-response-height @changed (into [animated-view {:style (st/container h)}] elements))}))) (defn suggestion-container [] - (let [h (anim/create-value 0.1) - command? (subscribe [:command?])] - (when-not @command? - [container h - [header h] - [suggestions-view] - [view {:height c/input-height}]]))) + (let [h (anim/create-value c/input-height)] + [container h + [header h] + [suggestions-view] + [view {:height c/input-height}]]))