apache / cordova-plugin-statusbar

Apache Cordova Status Bar Plugin
https://cordova.apache.org/
Apache License 2.0
617 stars 482 forks source link

[iOS] StatusBarStyle {lightcontent} are always set to {darkcontent} with ios@6.0.0 #192

Open mosabab opened 4 years ago

mosabab commented 4 years ago

Bug Report

Problem

<preference name="StatusBarStyle" value="lightcontent" /> not work take the action when you build the iOS.

What is expected to happen?

<preference name="StatusBarStyle" value="lightcontent" /> should be take the action when you build your iOS app.

What does actually happen?

If you set <preference name="StatusBarStyle" value="lightcontent" /> in your config.xml and you try to build your project with cordova platform add ios@6.0.0 And after that open the project at Xcode, you will see that statusbar set to default which mean: (dark text, light background) instead of lightcontent which mean: light text, dark background

In other words: What actually happened for now is: The default value {lightcontent} appear as {dark text for light background}.

Information

What i did to fix this issue as a temporary solution, I change the the style manually by js code after onDeviceReady() like the following:

function onDeviceReady() { StatusBar.styleLightContent(); }

Command or Code

In your config.xml put the preference to <preference name="StatusBarStyle" value="lightcontent" /> And after building your app using cordova command cordova platform add ios@6.0.0 , try open the project in Xcode.

Environment, Platform, Device

macOS, iOS 13.5, iPhone Series (8, 11) or even emulator.

Version information

Cordova CLI v9.0.0 cordova-plugin-statusbar #master version. Xcode 11.5 cordova-ios v6.0.0

Checklist

peitschie commented 3 years ago

Just noting that I had to wait until after I'd hidden the splash screen in order for StatusBar.styleLightContent(); to work for me on iOS.

I suspect this is being caused by some interactions with cordova-plugin-splashscreen...

breautek commented 3 years ago

There's been fixes related to the splashscreen that was released in 6.1.0.

I'd suggest reconfirming the issue still exists in the current latest (6.1.1) and ensure that you're also using the latest versino of the splashscreen which has iOS bits removed (since it's implemented in cordova-ios core now).

In fact, if you only develop for iOS, it's safe to remove this plugin now.

peitschie commented 3 years ago

@breautek interesting to hear... thanks for the tip! Just to confirm, are you meaning cordova-ios version 6.1.1?

cordova-ioss@6.1.1 is the version I'm currently running, though I still have the splash screen plugin installed as I need capabilities for Android still.

breautek commented 3 years ago

@breautek interesting to hear... thanks for the tip! Just to confirm, are you meaning cordova-ios version 6.1.1?

cordova-ioss@6.1.1 is the version I'm currently running, though I still have the splash screen plugin installed as I need capabilities for Android still.

~Yes, I mean cordova-ios@6.1.1. You should also be using cordova-plugin-splashscreen@6.0.0 to avoid conflicts between the plugin and the implemented provided by the cordova-ios framework.~

~If you can confirm if the issue is still present with the mentioned versions or not, that would be helpful.~

Doh, I just realized this is the statusbar -- not the splashscreen. Disregard everything I said in this thread :sleeping:

peitschie commented 3 years ago

@breautek no worries... it's all been useful information to know!

I'm running those exact versions, so yeah... issue is still there. I presume based on what you've said that this means the issue is either in cordova-ios or cordova-plugin-statusbar?

breautek commented 3 years ago

@breautek no worries... it's all been useful information to know!

I'm running those exact versions, so yeah... issue is still there. I presume based on what you've said that this means the issue is either in cordova-ios or cordova-plugin-statusbar?

Yes, most likely the statusbar plugin. I'm not equipped to actually troubleshoot this since I don't have mac hardware, so I'm afraid I cannot be much help.