Last active
April 7, 2020 18:08
-
-
Save ramonsenadev/10a6ede737e7b0036466f101f284c805 to your computer and use it in GitHub Desktop.
Status Bar Dark Content Not Working On iOS 13 Dark Mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> I solved the problem. | |
> | |
> Apple has added a new constant to the status bar with the latest update, so dark-content doesn't work. (in dark-mode) | |
> | |
> https://developer.apple.com/documentation/uikit/uistatusbarstyle?language=objc | |
> | |
> New Constant: UIStatusBarStyleDarkContent - A dark status bar, intended for use on light backgrounds. | |
> | |
> * Open XCode | |
> * Search: RCTStatusBarManager.m | |
> * Pods/Development Pods/React-Core/Modules/RCTStatusBarManager.m (xCode) | |
> * Other Editor | |
> node_modules/react-native/React/RCTStatusBarManager.m | |
> | |
> ``` | |
> RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{ | |
> @"default": @(UIStatusBarStyleDefault), | |
> @"light-content": @(UIStatusBarStyleLightContent), | |
> @"dark-content": @(UIStatusBarStyleDefault), | |
> }), UIStatusBarStyleDefault, integerValue); | |
> ``` | |
> | |
> To Change: | |
> | |
> ``` | |
> #pragma clang diagnostic push | |
> #pragma clang diagnostic ignored "-Wunguarded-availability" | |
> | |
> RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{ | |
> @"default": @(UIStatusBarStyleDefault), | |
> @"light-content": @(UIStatusBarStyleLightContent), | |
> @"dark-content": (@available(iOS 13.0, *)) ? @(UIStatusBarStyleDarkContent) : @(UIStatusBarStyleDefault), | |
> }), UIStatusBarStyleDefault, integerValue); | |
> | |
> #pragma clang diagnostic pop | |
> ``` | |
https://github.com/facebook/react-native/issues/26619#issuecomment-536191518 | |
> I tried both the self.window and rootView overrides and neither worked for me. I finally discovered a workaround that works in 13.1.2. | |
> Add this to your plist file: | |
> | |
> ``` | |
> <key>UIUserInterfaceStyle</key> | |
> <string>Light</string> | |
> ``` | |
https://github.com/facebook/react-native/issues/26299#issuecomment-540261084 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment