Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new styleDarkContent #164

Open
jcesarmobile opened this issue Oct 22, 2019 · 10 comments · May be fixed by #181
Open

Add new styleDarkContent #164

jcesarmobile opened this issue Oct 22, 2019 · 10 comments · May be fixed by #181

Comments

@jcesarmobile
Copy link
Member

That sets the native value to UIStatusBarStyleDarkContent. Note that it's an iOS 13 value, so in older version it should set the value to UIStatusBarStyleDefault as it used to have the same effect (set text to black color)

@ShaneMosley
Copy link

What's the status with this? As of right now, we cannot make the status bar dark on a light background with iOS 13.

@jcesarmobile
Copy link
Member Author

You can with default, but it’s not released

@ShaneMosley
Copy link

So this fix will be implemented in the next release of this plugin? And if so, do you know when that might be?

@ShaneMosley
Copy link

Sorry, just a bit confused with your statement

@jcesarmobile
Copy link
Member Author

Yes, will be on next release, or you can install from github directly

@ShaneMosley
Copy link

Oh legit! I see what you mean now. I can do it now with sticking with default because you already committed a change. I will do that :) Thanks again!

@exxbrain
Copy link

exxbrain commented Mar 20, 2020

I think UIStatusBarStyleDefault will be useful as well for device configuration related theme, so please do not deprecate StatusBar.styleDefault.

exxbrain pushed a commit to exxbrain/cordova-plugin-statusbar that referenced this issue Mar 20, 2020
exxbrain pushed a commit to exxbrain/cordova-plugin-statusbar that referenced this issue Mar 20, 2020
exxbrain pushed a commit to exxbrain/cordova-plugin-statusbar that referenced this issue Mar 20, 2020
exxbrain pushed a commit to exxbrain/cordova-plugin-statusbar that referenced this issue Mar 20, 2020
exxbrain added a commit to exxbrain/cordova-plugin-statusbar that referenced this issue Mar 22, 2020
@andresbelt
Copy link

for me works this

if( this.style == 'dark') {
this.statusBar.backgroundColorByHexString('#000000');
this.statusBar.styleDefault()
}else{
this.statusBar.backgroundColorByHexString('#ffffff');
this.statusBar.styleLightContent();
}

But I change this line in CDVStatusBar.m in my xcode project

  • (void) styleLightContent:(CDVInvokedUrlCommand*)command
    {
    [self setStyleForStatusBar:UIStatusBarStyleDarkContent]; ---> this UIStatusBarStyleDarkContent for ios 13.0
    }

@derweise
Copy link

for me works this

if( this.style == 'dark') {
this.statusBar.backgroundColorByHexString('#000000');
this.statusBar.styleDefault()
}else{
this.statusBar.backgroundColorByHexString('#ffffff');
this.statusBar.styleLightContent();
}

But I change this line in CDVStatusBar.m in my xcode project

  • (void) styleLightContent:(CDVInvokedUrlCommand*)command
    {
    [self setStyleForStatusBar:UIStatusBarStyleDarkContent]; ---> this UIStatusBarStyleDarkContent for ios 13.0
    }

How can I retrieve in CDVStatusBar.m the iOS version of the device and then set the value accordingly?

@jtumain
Copy link

jtumain commented Oct 9, 2020

@derweise I did the following to achieve this. I made a new styleDarkContent function.

-(void) styleDarkContent:(CDVInvokedUrlCommand*)command
{
    if (@available(iOS 13, *)) {
        [self setStyleForStatusBar:UIStatusBarStyleDarkContent];
    } else {
        [self styleDefault:command];
    }
}

If iOS 13 or greater style dark content because it isn't supported by older versions; else use default.

I also added this to the header file.
- (void) styleDarkContent:(CDVInvokedUrlCommand*)command;

And if you're using Ionic or TS interfaces added a styleDarkContent function in the type definitions file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants