Git Product home page Git Product logo

Comments (11)

breautek avatar breautek commented on August 17, 2024 3

Despite the config, it looks like the status bar is in overlay mode. I took a quick look at the src code, and I think line 121 of CDVStatusBar.m is the fault.

_statusBarOverlaysWebView = YES; // default

I don't see at any point where the plugin on pluginInitialize obeys the config.xml value, and it appears hard code _statusBarOverlaysWebview = YES;

Does the problem persist if you programmatically turn overlay off by using StatusBar.overlaysWebView(false); after the device ready event fires?

from cordova-plugin-statusbar.

bvosk avatar bvosk commented on August 17, 2024 2

@breautek That worked for me, so it seems you're right. Thanks so much for the help!

from cordova-plugin-statusbar.

breautek avatar breautek commented on August 17, 2024 2

@stefangroenew The javascript solution wasn't really a solution. More like a workaround. The real solution in my opinion is to fix the native objective-c code to pull in the preference values from config.xml. That is however outside of my knowledge. I'm not an experienced iOS developer, nor do I have a personal iphone or mac to use to test with.

from cordova-plugin-statusbar.

bvosk avatar bvosk commented on August 17, 2024

@stefangroenew Did you find any workaround to this? This has been a big problem for me with multiple apps. We've had to revert to earlier version of the Cordova CLI.

from cordova-plugin-statusbar.

stefangroenew avatar stefangroenew commented on August 17, 2024

@bvosk Unfortunately I have not found a solution yet. Which version of Phonegap Build do you use? Can you send the config.xml code snippet? Thanks!

from cordova-plugin-statusbar.

bvosk avatar bvosk commented on August 17, 2024

@stefangroenew Using this preference in the config.xml file makes the status bar work for us:

<preference name="phonegap-version" value="cli-6.5.0" />

Note that this causes problems on Android, so we've been building different copies for iOS and Android.

from cordova-plugin-statusbar.

stefangroenew avatar stefangroenew commented on August 17, 2024

@breautek @bvosk Thank you for your comments, unfortunately the Javascript solution after the DeviceReady will not work (on IOS).

I have set a lime color that works well on Android.

StatusBar.overlaysWebView(false); StatusBar.backgroundColorByHexString("#adf907");

However, this does not work on IOS. The color is visible a verry short time. See this video:
https://youtu.be/RS_5hFCWHSU

Any idea? Thanks! Stefan

from cordova-plugin-statusbar.

stefangroenew avatar stefangroenew commented on August 17, 2024

@breautek @bvosk I found the issue! The Javascript solution was working but the framework I use was overwrite some settings. More info:

https://framework7.io/docs/statusbar.html#statusbar-styling

Thanks again for the help! Stefan

from cordova-plugin-statusbar.

bvosk avatar bvosk commented on August 17, 2024

@stefangroenew I agree with @breautek, would better to leave this open because it should respect the preference in the config.xml file.

from cordova-plugin-statusbar.

breautek avatar breautek commented on August 17, 2024

I did a little bit more investigating and found that this isn't indeed only an iOS issue.

On Android, StatusBarBackgroundColor, StatusBarStyle both do appear to work on startup. StatusBarOverlaysWebView however does not. Additionally Android does not use overlay mode by default, despite what the documentation says.

For android it appears to be an easy fix

// Read 'StatusBarBackgroundColor' from config.xml, default is #000000.
setStatusBarBackgroundColor(preferences.getString("StatusBarBackgroundColor", "#000000"));
// Read 'StatusBarStyle' from config.xml, default is 'lightcontent'.
setStatusBarStyle(preferences.getString("StatusBarStyle", "lightcontent"));

We can see here it looks at the preference and sets up accordingly for the other preferences. But it doesn't do that for StatusBarOverlaysWebView. It doesn't even set it to true by default like iOS does.

Makes me wonder if it is better to keep it false by default for android and make a note in the documentation rather than changing the behaviour and potentially causing unexpected changes for people.

from cordova-plugin-statusbar.

jcesarmobile avatar jcesarmobile commented on August 17, 2024

I can't reproduce on latest version of the plugin, cordova and cordova-ios.
The code for checking the preference has always been there according to the git blame
9 years ago https://github.com/apache/cordova-plugin-statusbar/blame/3795486e33a4a9113773d5e688374d142f93828c/src/ios/CDVStatusBar.m#L113-L115
7 years ago https://github.com/apache/cordova-plugin-statusbar/blame/1672883a7fda51e73069d6f350393bb2719228e3/src/ios/CDVStatusBar.m#L190-L196

As far as I remember phonegap build had a problem with preferences not working and some users mention phonegap build, so it was probably the issue.
If somebody still faces the issue with latest cordova, cordova-ios and cordova-plugin-statusbar, please, create a new issue and provide a sample app where the issue can be reproduced.

from cordova-plugin-statusbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.