question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Status Bar Dark Content Not Working On iOS 13 Dark Mode

See original GitHub issue

React Native version: 0.60.0

Steps To Reproduce

  1. StatusBar.setBarStyle(‘dark-content’); // Not Working

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:35
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

112reactions
mronlinecommented, Sep 28, 2019

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
61reactions
gpawlikcommented, Sep 27, 2019

As a workaround you could probably update the following keys in the Info.plist file, overriding the system dark mode:

<key>UIUserInterfaceStyle</key>
<string>Light</string>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent iOS 13's Dark Mode from changing the text ...
I'm guessing your solution has the same problem I'm experiencing (black status bar text in light mode; white status bar text in dark...
Read more >
Status bar stays black even when set to light - Apple Developer
- as of iOS 7, the light / dark refers to the *text*, not the background, of the status bar. The bar itself...
Read more >
React Native StatusBar dark-content not working on iOS 13 ...
QuestionReact Native 0.60.5 . Light mode in iOS 13 or earlier versions is normal. However, there is no effect in iOS 13 Dark...
Read more >
How to always display dark text in the status bar of an iOS ...
In applications with a white form background, dark mode sets the status bar text color to white, resulting in the text no longer...
Read more >
Implementing Dark Mode in iOS 13
After years of waiting and anticipation, iOS 13 finally supports native Dark Mode! Users can choose to enable a system wide dark appearance...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found