From fc12e22535b4e93d8b39eeeecf2f488f5ac3d45c Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Tue, 28 Aug 2018 18:47:35 +0300 Subject: [PATCH] Fix error view jumps --- .../ui/components/connectivity/styles.cljs | 10 +++- .../ui/screens/desktop/main/chat/views.cljs | 55 +++++++++---------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/status_im/ui/components/connectivity/styles.cljs b/src/status_im/ui/components/connectivity/styles.cljs index a447877940..8d0563fe38 100644 --- a/src/status_im/ui/components/connectivity/styles.cljs +++ b/src/status_im/ui/components/connectivity/styles.cljs @@ -7,13 +7,17 @@ (cond-> {:opacity opacity :background-color colors/gray-notifications - :height 35} + :height 35 + :position :absolute} + platform/desktop? + (assoc + :left 0 + :right 0) (not platform/desktop?) (assoc :ios {:z-index 0} :width window-width - :top (+ (+ 56 top) (if pending? 35 0)) - :position :absolute))) + :top (+ (+ 56 top) (if pending? 35 0))))) (def text {:text-align :center diff --git a/src/status_im/ui/screens/desktop/main/chat/views.cljs b/src/status_im/ui/screens/desktop/main/chat/views.cljs index 0d40715579..4b5607abe4 100644 --- a/src/status_im/ui/screens/desktop/main/chat/views.cljs +++ b/src/status_im/ui/screens/desktop/main/chat/views.cljs @@ -27,40 +27,38 @@ :as current-chat}] (views/letsubs [chat-name [:get-current-chat-name] {:keys [pending? whisper-identity photo-path]} [:get-current-chat-contact]] - [react/view - [react/view {:style styles/toolbar-chat-view} - [react/view {:style {:flex-direction :row - :flex 1}} - (if public? - [react/view {:style (styles/topic-image color)} - [react/text {:style styles/topic-text} - (string/capitalize (second chat-name))]] - [react/image {:style styles/chat-icon - :source {:uri photo-path}}]) - [react/view {:style (styles/chat-title-and-type pending?)} - [react/text {:style styles/chat-title - :font :medium} - chat-name] - (cond pending? - [react/text {:style styles/add-contact-text - :on-press #(re-frame/dispatch [:add-contact whisper-identity])} - (i18n/label :t/add-to-contacts)] - public? - [react/text {:style styles/public-chat-text} - (i18n/label :t/public-chat)])]] - [react/view - (when (and (not group-chat) (not public?)) - [react/text {:style (styles/profile-actions-text colors/black) - :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} - (i18n/label :t/view-profile)]) + [react/view {:style styles/toolbar-chat-view} + [react/view {:style {:flex-direction :row + :flex 1}} + (if public? + [react/view {:style (styles/topic-image color)} + [react/text {:style styles/topic-text} + (string/capitalize (second chat-name))]] + [react/image {:style styles/chat-icon + :source {:uri photo-path}}]) + [react/view {:style (styles/chat-title-and-type pending?)} + [react/text {:style styles/chat-title + :font :medium} + chat-name] + (cond pending? + [react/text {:style styles/add-contact-text + :on-press #(re-frame/dispatch [:add-contact whisper-identity])} + (i18n/label :t/add-to-contacts)] + public? + [react/text {:style styles/public-chat-text} + (i18n/label :t/public-chat)])]] + [react/view + (when (and (not group-chat) (not public?)) + [react/text {:style (styles/profile-actions-text colors/black) + :on-press #(re-frame/dispatch [:show-profile-desktop whisper-identity])} + (i18n/label :t/view-profile)]) [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/clear-history-pressed])} (i18n/label :t/clear-history)] [react/text {:style (styles/profile-actions-text colors/black) :on-press #(re-frame/dispatch [:chat.ui/delete-chat-pressed chat-id])} - (i18n/label :t/delete-chat)]]] - [connectivity/error-view {:top 2}]])) + (i18n/label :t/delete-chat)]]])) (views/defview message-author-name [{:keys [outgoing from] :as message}] (views/letsubs [current-account [:get-current-account] @@ -155,6 +153,7 @@ (reset! chat-id* chat-id) (js/setTimeout #(when @scroll-ref (.scrollToEnd @scroll-ref)) 400))] [react/view {:style styles/messages-view} + [connectivity/error-view] [react/scroll-view {:scrollEventThrottle 16 :headerHeight styles/messages-list-vertical-padding :footerWidth styles/messages-list-vertical-padding