-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(core): statusBarStyle ease of use and more control #10859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Allows statusBarStyle to be defined on any view for explicit per view control, whether presented in modal or not. Note: You must remove Info.plist key `UIViewControllerBasedStatusBarAppearance` It defaults to true when not present: https://developer.apple.com/documentation/bundleresources/information-property-list/uiviewcontrollerbasedstatusbarappearance Or you can explicitly set it to true: <key>UIViewControllerBasedStatusBarAppearance</key> <true/> False value will make this property have no effect.
|
View your CI Pipeline Execution ↗ for commit 57692de
☁️ Nx Cloud last updated this comment at |
|
That implementation seems a bit "dangerous" in the sense that it will have inconsistent behaviours:
It seems much safer and controllable to have it implemented on a page for which we have navigation events for pages, modals, bottomsheets. You can see how i implemented it in https://github.com/nativescript-community/systemui |
|
@farfromrefug unfortunately https://developer.apple.com/documentation/uikit/uiapplication/setstatusbarhidden(_:with:)?language=objc been deprecated since iOS 9. The impl in systemui doesn't account for https://developer.apple.com/documentation/uikit/uiviewcontroller/preferredstatusbarstyle (this impl is what auto handles the cases of modals, setting, closing, going back to original) nor for modal cases via |
|
Although it's possible you could set statusBarStyle on a view (nested), the recommendation is to set on Page or with various flavors where you don't declare a Page directly (thus the changes), can set on the base View which helps those cases as well as modals. |
OK i understand. Indeed it seems good the way you set it up. thanks |
|
Good call @CatchABus updated to include handling android as well now while improving more with iOS: Added a demo page now which switches status bar color when navigating into within toolbox and can also open a modal which changes it again to provide easy to test the behavior. |
|
@farfromrefug I added a statusBarStyle check in onLoaded. If defined it will reset it to that particular page style when moving through pages. This solves, for example, the Android case where you navigate into a deep navigation stack with views that change status bar text colors. Now navigating back will restore whichever statusBarStyle each page was. Works on modal views as well 👍 This matches how iOS behaves with it's individual view controller checks (also using statusBarStyle). |
[skip ci]
Allows statusBarStyle to be defined on any view for explicit per view control, whether presented in modal or not.
Note: You must remove Info.plist key
UIViewControllerBasedStatusBarAppearanceIt defaults to true when not present: https://developer.apple.com/documentation/bundleresources/information-property-list/uiviewcontrollerbasedstatusbarappearance
Or you can explicitly set it to true:
False value will make this property have no effect.
Before
You could patch-package to control some cases but was dificult to have explicit control over status bar color in varied acute cases.

After
ShowModalOptionsnow allowsstatusBarStyleto be set withiniosoptions.