From ecd7ae26b8517238a8132c1561b28fa9d141498c Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Tue, 21 Jun 2016 10:27:07 +0300 Subject: [PATCH] hiding of param's suggestions --- src/status_im/chat/screen.cljs | 5 ++--- src/status_im/chat/views/message_input.cljs | 19 +++---------------- src/status_im/chat/views/plain_message.cljs | 4 ++-- src/status_im/chat/views/response.cljs | 1 + src/status_im/db.cljs | 2 +- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 2c04ab4859..35e39bf7ef 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -269,8 +269,7 @@ [messages-container [messages-view group-chat]] (when group-chat [typing-all]) - (cond - command? [response-view] - :else [suggestions-view]) + [response-view] + (when-not command? [suggestions-view]) [chat-message-new] (when show-actions-atom [actions-view])]) diff --git a/src/status_im/chat/views/message_input.cljs b/src/status_im/chat/views/message_input.cljs index 4a63d6cba5..fe2900ce63 100644 --- a/src/status_im/chat/views/message_input.cljs +++ b/src/status_im/chat/views/message_input.cljs @@ -1,20 +1,16 @@ (ns status-im.chat.views.message-input (:require-macros [status-im.utils.views :refer [defview]]) - (:require [re-frame.core :refer [subscribe dispatch]] - [reagent.core :as r] + (:require [re-frame.core :refer [subscribe]] [status-im.components.react :refer [view animated-view icon touchable-highlight - text-input - dismiss-keyboard!]] - [status-im.components.animation :as anim] + text-input]] [status-im.chat.views.plain-message :as plain-message] [status-im.chat.views.command :as command] [status-im.chat.styles.message-input :as st] [status-im.chat.styles.plain-message :as st-message] - [status-im.chat.styles.response :as st-response] - [status-im.constants :refer [response-input-hiding-duration]])) + [status-im.chat.styles.response :as st-response])) (defn send-button [{:keys [on-press accessibility-label]}] [touchable-highlight {:on-press on-press @@ -22,15 +18,6 @@ [view st/send-container [icon :send st/send-icon]]]) -(defn animation-logic [{:keys [to-value val]}] - (fn [_] - (let [to-value @to-value] - (anim/start (anim/timing val {:toValue to-value - :duration response-input-hiding-duration}) - (fn [arg] - (when (.-finished arg) - (dispatch [:set-animation ::message-input-offset-current to-value]))))))) - (defn message-input-container [input] [view st/message-input-container input]) diff --git a/src/status_im/chat/views/plain_message.cljs b/src/status_im/chat/views/plain_message.cljs index 7af02e7142..906fa17a93 100644 --- a/src/status_im/chat/views/plain_message.cljs +++ b/src/status_im/chat/views/plain_message.cljs @@ -64,8 +64,8 @@ (let [to-scale (if @command? 0 1)] (when-not @command? (anim/set-value width 56)) (anim/start (anim/spring val {:toValue to-scale}) - (fn [] - (when @command? + (fn [e] + (when (and @command? (.-finished e)) (anim/set-value width 0.1))))))) (defn smile-button [] diff --git a/src/status_im/chat/views/response.cljs b/src/status_im/chat/views/response.cljs index 7ff986e7a8..79f9a772ac 100644 --- a/src/status_im/chat/views/response.cljs +++ b/src/status_im/chat/views/response.cljs @@ -65,6 +65,7 @@ (defn container-animation-logic [{:keys [to-value val]}] (fn [_] + (println :to @to-value) (let [to-value @to-value] (anim/start (anim/spring val {:toValue to-value}))))) diff --git a/src/status_im/db.cljs b/src/status_im/db.cljs index e118920433..675606a664 100644 --- a/src/status_im/db.cljs +++ b/src/status_im/db.cljs @@ -37,7 +37,7 @@ :whisper-identity "" :phone-number ""} :disable-group-creation false - :animations {:to-response-height nil + :animations {:to-response-height 0.1 :response-height-current nil :command? false :messages-offset 0