From 6da18d3fca642ef7aa7d705b46b7397dd35e0e12 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Thu, 20 Apr 2017 15:56:30 +0300 Subject: [PATCH] fixes https://github.com/status-im/status-react/issues/1055 --- src/status_im/chat/screen.cljs | 13 ++++++++----- src/status_im/chat/subs.cljs | 12 ++++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/status_im/chat/screen.cljs b/src/status_im/chat/screen.cljs index 85f51fab26..96f9725cf1 100644 --- a/src/status_im/chat/screen.cljs +++ b/src/status_im/chat/screen.cljs @@ -108,13 +108,18 @@ [text {:style st/add-contact-text} (label :t/add-to-contacts)]]])) +(defview overlay-view [] + [show-chat-overlay? [:show-chat-overlay?]] + (when show-chat-overlay? + [view {:style st/result-box-overlay}])) + (defview chat-toolbar [] [show-actions? [:chat-ui-props :show-actions?] - show-chat-overlay? [:show-chat-overlay?] accounts [:get :accounts] + show-chat-overlay? [:show-chat-overlay?] creating? [:get :creating-account?]] [view (when show-chat-overlay? {:style {:zIndex 0}}) - [status-bar {:type (if show-chat-overlay? :overlay :default)}] + [status-bar] [toolbar {:hide-nav? (or (empty? accounts) show-actions? creating?) :custom-content [toolbar-content-view] :custom-action [toolbar-action]}] @@ -176,7 +181,6 @@ show-actions? [:chat-ui-props :show-actions?] show-bottom-info? [:chat-ui-props :show-bottom-info?] show-emoji? [:chat-ui-props :show-emoji?] - show-chat-overlay? [:show-chat-overlay?] layout-height [:get :layout-height] input-text [:chat :input-text]] {:component-did-mount #(dispatch [:check-autorun]) @@ -188,8 +192,7 @@ (dispatch [:set-layout-height height]))))} [chat-toolbar] [messages-view group-chat] - (when show-chat-overlay? - [view {:style st/result-box-overlay}]) + [overlay-view] [input/container {:text-empty? (str/blank? input-text)}] (when show-actions? [actions-view]) diff --git a/src/status_im/chat/subs.cljs b/src/status_im/chat/subs.cljs index a6acf522b0..106d6de394 100644 --- a/src/status_im/chat/subs.cljs +++ b/src/status_im/chat/subs.cljs @@ -125,10 +125,14 @@ (register-sub :show-chat-overlay? (fn [db _] - (let [show-parameter-box? (subscribe [:show-parameter-box?]) - result-box (subscribe [:chat-ui-props :result-box])] - (reaction (or @show-parameter-box? - @result-box))))) + (let [{:keys [current-chat-id]} @db + show-parameter-box? (subscribe [:show-parameter-box?]) + result-box (subscribe [:chat-ui-props :result-box]) + max-height (subscribe [:get-max-container-area-height]) + result-box-height (subscribe [:get-in [:chat-animations current-chat-id :result-box :height]]) + parameter-box-height (subscribe [:get-in [:chat-animations current-chat-id :parameter-box :height]])] + (reaction (or (and @show-parameter-box? (or (= @parameter-box-height :max) (< (- @max-height @parameter-box-height) 20))) + (and @result-box (or (= @result-box-height :max) (< (- @max-height @result-box-height) 20)))))))) (register-sub :command-completion