Fix statusbar color on dark screens (#18785)

This commit is contained in:
Ibrahem Khalil 2024-02-28 18:53:13 +02:00 committed by GitHub
parent 1301bbc0d9
commit 7db35a3cc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 30 additions and 9 deletions

View File

@ -133,7 +133,7 @@
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<false/>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A00000080400010101</string>

View File

@ -53,7 +53,7 @@
:FlatList {}
:SectionList {}
:Text {}
:StatusBar {}
:StatusBar {:setBarStyle identity}
:ScrollView {}
:SafeAreaView {}
:KeyboardAvoidingView {}

View File

@ -210,3 +210,5 @@
(def linking (.-Linking react-native))
(defn open-url [link] (.openURL ^js linking link))
(def set-status-bar-style react-native/StatusBar.setBarStyle)

View File

@ -1,5 +1,7 @@
(ns status-im.navigation.effects
(:require
[quo.theme]
[react-native.core :as rn]
[react-native.navigation :as navigation]
[status-im.navigation.options :as options]
[status-im.navigation.roots :as roots]
@ -8,10 +10,20 @@
[taoensso.timbre :as log]
[utils.re-frame :as rf]))
(defn- set-status-bar-color
[theme]
(rn/set-status-bar-style
(if (= theme :dark)
"light-content"
"dark-content")
true))
(rf/reg-fx :set-view-id-fx
(fn [view-id]
(rf/dispatch [:screens/on-will-focus view-id])
(when-let [{:keys [on-focus]} (get views/screens view-id)]
(when-let [{:keys [on-focus options]} (get views/screens view-id)]
(set-status-bar-color (or (:theme options)
(quo.theme/get-theme)))
(when on-focus
(rf/dispatch on-focus)))))
@ -117,11 +129,12 @@
(defn open-modal
[component]
(let [{:keys [options]} (get views/screens component)
sheet? (:sheet? options)]
(let [{:keys [options name]} (get views/screens component)
sheet? (:sheet? options)]
(if @state/dissmissing
(reset! state/dissmissing component)
(do
(set-view-id name) ; TODO https://github.com/status-im/status-mobile/issues/18811
(reset! state/curr-modal true)
(swap! state/modals conj component)
(navigation/show-modal

View File

@ -137,9 +137,6 @@
:decelerate
:factor 1.5}}]}}})
(def camera-screen
{:navigationBar {:backgroundColor colors/black}})
(defn merge-top-bar
[root-options options]
(let [options (:topBar options)]

View File

@ -1,6 +1,7 @@
(ns status-im.navigation.screens
(:require
[legacy.status-im.ui.screens.screens :as old-screens]
[quo.foundations.colors :as colors]
[status-im.common.emoji-picker.view :as emoji-picker]
[status-im.common.lightbox.view :as lightbox]
[status-im.config :as config]
@ -142,7 +143,8 @@
:component photo-selector/photo-selector}
{:name :camera-screen
:options options/camera-screen
:options {:navigationBar {:backgroundColor colors/black}
:theme :dark}
:component camera-screen/camera-screen}
{:name :new-contact
@ -433,6 +435,13 @@
:options options/transparent-modal-screen-options
:component settings-password/view}]
[{:name :shell
:options {:theme :dark}}
{:name :communities-stack}
{:name :chats-stack}
{:name :wallet-stack}
{:name :browser-stack}]
(when js/goog.DEBUG
[{:name :dev-component-preview
:options {:sheet? true}