From 9d7691312be1f2427c2513cb1e9d680e68013880 Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Thu, 28 May 2020 09:37:21 +0200 Subject: [PATCH] Fix topbar back-button flickering Signed-off-by: Andrea Maria Piana --- src/status_im/ui/components/chat_icon/screen.cljs | 2 ++ src/status_im/ui/components/topbar.cljs | 5 +++-- src/status_im/ui/screens/chat/message/message.cljs | 2 +- src/status_im/ui/screens/chat/sheets.cljs | 1 + src/status_im/ui/screens/chat/views.cljs | 1 + src/status_im/ui/screens/home/views/inner_item.cljs | 3 +++ 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/status_im/ui/components/chat_icon/screen.cljs b/src/status_im/ui/components/chat_icon/screen.cljs index 33d80cc0b8..60060201c8 100644 --- a/src/status_im/ui/components/chat_icon/screen.cljs +++ b/src/status_im/ui/components/chat_icon/screen.cljs @@ -8,6 +8,8 @@ [status-im.ui.screens.chat.photos :as photos] [status-im.utils.platform :as platform])) +;;TODO REWORK THIS NAMESPACE + (defn default-chat-icon [name styles] (when-not (string/blank? name) [react/view (:default-chat-icon styles) diff --git a/src/status_im/ui/components/topbar.cljs b/src/status_im/ui/components/topbar.cljs index 4def503f29..c94bd970b5 100644 --- a/src/status_im/ui/components/topbar.cljs +++ b/src/status_im/ui/components/topbar.cljs @@ -33,9 +33,10 @@ [react/text {:style {:color colors/blue}} (utils.label/stringify label)])]])) +(def default-title-padding 16) ;; TODO(Ferossgp): Tobbar should handle safe area -(defn topbar [_] - (let [title-padding (reagent/atom 16)] +(defn topbar [{:keys [initial-title-padding]}] + (let [title-padding (reagent/atom (or initial-title-padding default-title-padding))] (fn [& [{:keys [title navigation accessories show-border? modal? content]}]] (let [navigation (or navigation (default-navigation modal?))] [react/view (cond-> {:height 56 :align-items :center :flex-direction :row} diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index 1a53dca15e..62f6c59f82 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -38,7 +38,7 @@ appender]) (defview quoted-message - [_ {:keys [from text]} outgoing current-public-key public?] + [_ {:keys [from text image]} outgoing current-public-key public?] (letsubs [contact-name [:contacts/contact-name-by-identity from]] [react/view {:style (style/quoted-message-container outgoing)} [react/view {:style style/quoted-message-author-container} diff --git a/src/status_im/ui/screens/chat/sheets.cljs b/src/status_im/ui/screens/chat/sheets.cljs index bede117ca4..89318f96cf 100644 --- a/src/status_im/ui/screens/chat/sheets.cljs +++ b/src/status_im/ui/screens/chat/sheets.cljs @@ -6,6 +6,7 @@ [status-im.utils.universal-links.core :as universal-links] [status-im.ui.components.chat-icon.screen :as chat-icon] [status-im.ui.components.colors :as colors] + [status-im.multiaccounts.core :as multiaccounts] [status-im.utils.platform :as platform] [status-im.ui.screens.chat.styles.message.sheets :as sheets.styles] [status-im.ui.components.list-item.views :as list-item])) diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index a225d02d6c..7ccebf083f 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -27,6 +27,7 @@ [topbar/topbar {:content [toolbar-content/toolbar-content-view] :show-border? true + :initial-title-padding 56 :navigation {:icon :main-icons/back :accessibility-label :back-button :handler diff --git a/src/status_im/ui/screens/home/views/inner_item.cljs b/src/status_im/ui/screens/home/views/inner_item.cljs index 6b88030b15..9483e72921 100644 --- a/src/status_im/ui/screens/home/views/inner_item.cljs +++ b/src/status_im/ui/screens/home/views/inner_item.cljs @@ -121,6 +121,9 @@ :else nil) :title (if group-chat (utils/truncate-str chat-name 30) + ;; This looks a bit odd, but I would like only to subscribe + ;; if it's a one-to-one. If wrapped in a component styling + ;; won't be applied correctly. @(re-frame/subscribe [:contacts/contact-name-by-identity chat-id])) :title-accessibility-label :chat-name-text :title-row-accessory [message-timestamp (if (pos? (:whisper-timestamp last-message))