[#6043] [android] fix "Fetching messages..." shifted down when appears in public chat modal
This commit is contained in:
parent
3002ca5b07
commit
c91e503b94
|
@ -3,9 +3,9 @@
|
||||||
(:require [status-im.ui.components.colors :as colors]
|
(:require [status-im.ui.components.colors :as colors]
|
||||||
[status-im.utils.platform :as platform]))
|
[status-im.utils.platform :as platform]))
|
||||||
|
|
||||||
(defnstyle text-wrapper [top opacity window-width pending?]
|
(defnstyle text-wrapper [{:keys [top window-width pending? modal?]}]
|
||||||
(cond->
|
(cond->
|
||||||
{:opacity opacity
|
{:opacity 1.0
|
||||||
:background-color colors/gray-notifications
|
:background-color colors/gray-notifications
|
||||||
:height 35
|
:height 35
|
||||||
:position :absolute}
|
:position :absolute}
|
||||||
|
@ -17,7 +17,9 @@
|
||||||
(assoc
|
(assoc
|
||||||
:ios {:z-index 0}
|
:ios {:z-index 0}
|
||||||
:width window-width
|
:width window-width
|
||||||
:top (+ (+ 56 top) (if pending? 35 0)))))
|
:top (+ top
|
||||||
|
(if (and modal? platform/android?) 31 56)
|
||||||
|
(if pending? 35 0)))))
|
||||||
|
|
||||||
(def text
|
(def text
|
||||||
{:text-align :center
|
{:text-align :center
|
||||||
|
|
|
@ -6,6 +6,22 @@
|
||||||
[status-im.ui.components.connectivity.styles :as styles]
|
[status-im.ui.components.connectivity.styles :as styles]
|
||||||
[status-im.i18n :as i18n]))
|
[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]}]
|
(defview error-view [{:keys [top]}]
|
||||||
(letsubs [offline? [:offline?]
|
(letsubs [offline? [:offline?]
|
||||||
disconnected? [:disconnected?]
|
disconnected? [:disconnected?]
|
||||||
|
@ -21,9 +37,10 @@
|
||||||
fetching? :t/fetching-messages
|
fetching? :t/fetching-messages
|
||||||
:else nil)]
|
:else nil)]
|
||||||
(let [pending? (and (:pending current-chat-contact) (= :chat view-id))]
|
(let [pending? (and (:pending current-chat-contact) (= :chat view-id))]
|
||||||
[react/view {:style (styles/text-wrapper top 1.0 window-width pending?)
|
[error-label
|
||||||
:accessibility-label :connection-status-text}
|
{:view-id view-id
|
||||||
[react/text {:style styles/text
|
:top top
|
||||||
:on-press (when mailserver-error?
|
:window-width window-width
|
||||||
#(re-frame/dispatch [:inbox/reconnect]))}
|
:pending? pending?
|
||||||
(i18n/label label)]]))))
|
:label label
|
||||||
|
:mailserver-error? mailserver-error?}]))))
|
||||||
|
|
Loading…
Reference in New Issue