2
votes

I am using the status bar plugin :

https://github.com/apache/cordova-plugin-statusbar

and in my config.xml I have the following set:

<preference name="StatusBarOverlaysWebView" value="true"/>
<preference name="StatusBarStyle" value="lightcontent" />

<feature name="StatusBar">
   <param name="ios-package" value="CDVStatusBar" onload="true" />
</feature>

and in my app.js, I have this:

if (window.StatusBar) {
    if (ionic.Platform.isAndroid()) {
        StatusBar.backgroundColorByHexString("#2DBE60");
    } else {
        StatusBar.styleLightContent();
    }
}

It works fine on Android but in IOS, if I set the StatusBarOverlaysWebView to true, the view is behind the status bar and that's not what I want. If I set the StatusBarOverlaysWebView to false, it works, but the issue is when the transitions to another, the status bar turns black for a few seconds and then goes white again.

How can I set it so that top status bar is white and stays that way even when navigating between pages on IOS .

1

1 Answers

0
votes

Did you try the statusBarInstace.hide() method of the same plugin?

In one case, i had to write this below code inside the platform.ready function in the constructor of the page i am showing.

platform.ready().then(()=> statusbar.hide());

At time you may need to wrap the above code in a setTimeout function to cause a delayed execution.

Good luck