iOS 17 - New status bar default style doesn't work if the status bar was previously hidden

Hi, I adopted in my app the new default style for the status bar where it switches between light and dark themes depending on the color of the content beneath. It works great until I hide the status bar and show it again. From that point onwards, the status bar will be stuck on the dark or light theme, depending on the app's theme.

This happens as well if the status bar is initially hidden on startup. In that case, the default behavior never works.

I filed an issue (FB13222217), and as of now I didn't find a workaround except never hiding the status bar on my app. I attached a super minimalist example project there, just a scroll view with black and white views and nothing more.

This happens on SwiftUI and UIKit as well.

I hope the issue can be addressed and will appreciate if anyone has a workaround for this to let me know.

Thanks!

If possible, can you verify this on the latest iOS 17.1 beta? We think we've fixed this there, but want to ensure that your issue is the same one we've fixed. Thanks!

In my case, I override preferredStatusBarStyle in the view controller, then the color is right.

I am facing the same issue with iOS 17.5.1 although I have found a workaround.

I noticed that the status bar reset to the desired default behavior when toggling the OS preferred color scheme (light/dark mode). I tried to reproduced such a thing in code and was able to achieve similar results by returning either lightContent or darkContent for preferredStatusBarStyle when updating the status bar appearance after changing its visibility value. Then requesting again an update with the default value for preferredStatusBarStyle.

It looks something like this.

// returned by `prefersStatusBarHidden`
isStatusBarHidden = false
// returned by `preferredStatusBarStyle`
preferredStyle = .darkContent
setNeedsStatusBarAppearanceUpdate()

// here we reset to default
preferredStyle = .default
setNeedsStatusBarAppearanceUpdate()
// status bar style should be back to desired default behavior

Hoping iOS 18 will fix this issue 🤞

iOS 17 - New status bar default style doesn't work if the status bar was previously hidden
 
 
Q