apache/cordova-plugin-statusbar

The plugin overwrites windowLightNavigationBar theme settings

Opened this issue · 0 comments

Bug Report

Problem

What is expected to happen?

Setting <item name="android:windowLightNavigationBar">true</item> should work as expected.

What does actually happen?

It's getting overwritten indirectly by statusbar plugin.

Information

in StatusBar.java in setStatusBarTransparent function when using setSystemUiVisibility the function overwrites windowLightNavigationBar setting which is set in xml theme. The plugin might consider another way to set those flags which doesn't overwrite navigation bar theme or add View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR flag based on the current app theme.

Command or Code

You can try it by adding this theme to themes.xml, here I'm using Splashscreen plugin, but a custom theme could also be defined in config.xml:

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <style name="Theme.App.SplashScreen" parent="Theme.SplashScreen.IconBackground">
        <item name="windowSplashScreenBackground">@color/cdv_splashscreen_background</item>
        <item name="windowSplashScreenAnimatedIcon">@drawable/ic_cdv_splashscreen</item>
        <item name="windowSplashScreenAnimationDuration">200</item>
        <item name="postSplashScreenTheme">@style/MyTheme</item>
    </style>
    <style name="MyTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:navigationBarColor">#ffffff</item>
        <item name="android:windowLightNavigationBar">true</item>
    </style>
</resources>

Environment, Platform, Device

Android

Version information

cordova: 12.0.0
cordova-plugin-statusbar: 4.0.0

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above