[#6043] [android] fix "Fetching messages..." shifted down when appears in public chat modal

This commit is contained in:
Roman Volosovskyi 2018-09-30 10:14:01 +03:00
parent 3002ca5b07
commit c91e503b94
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
2 changed files with 32 additions and 13 deletions

View File

@ -3,21 +3,23 @@
(:require [status-im.ui.components.colors :as colors]
[status-im.utils.platform :as platform]))
(defnstyle text-wrapper [top opacity window-width pending?]
(defnstyle text-wrapper [{:keys [top window-width pending? modal?]}]
(cond->
{:opacity opacity
{:opacity 1.0
:background-color colors/gray-notifications
:height 35
:position :absolute}
platform/desktop?
(assoc
:left 0
:right 0)
:left 0
:right 0)
(not platform/desktop?)
(assoc
:ios {:z-index 0}
:width window-width
:top (+ (+ 56 top) (if pending? 35 0)))))
:ios {:z-index 0}
:width window-width
:top (+ top
(if (and modal? platform/android?) 31 56)
(if pending? 35 0)))))
(def text
{:text-align :center

View File

@ -6,6 +6,22 @@
[status-im.ui.components.connectivity.styles :as styles]
[status-im.i18n :as i18n]))
(defview error-label
[{:keys [view-id label mailserver-error?] :as opts}]
{:should-component-update
(fn [_ [_ old-props] [_ new-props]]
;; prevents flickering on navigation
(= (:view-id old-props) (:view-id new-props)))}
(let [wrapper-style (styles/text-wrapper
(assoc opts :modal? (= view-id :chat-modal)))]
[react/view {:style wrapper-style
:accessibility-label :connection-status-text}
[react/text {:style styles/text
:on-press (when mailserver-error?
#(re-frame/dispatch [:inbox/reconnect]))}
(i18n/label label)]]))
(defview error-view [{:keys [top]}]
(letsubs [offline? [:offline?]
disconnected? [:disconnected?]
@ -21,9 +37,10 @@
fetching? :t/fetching-messages
:else nil)]
(let [pending? (and (:pending current-chat-contact) (= :chat view-id))]
[react/view {:style (styles/text-wrapper top 1.0 window-width pending?)
:accessibility-label :connection-status-text}
[react/text {:style styles/text
:on-press (when mailserver-error?
#(re-frame/dispatch [:inbox/reconnect]))}
(i18n/label label)]]))))
[error-label
{:view-id view-id
:top top
:window-width window-width
:pending? pending?
:label label
:mailserver-error? mailserver-error?}]))))