react-native-navigation-bar-color icon indicating copy to clipboard operation
react-native-navigation-bar-color copied to clipboard

Modal/Popover backdrop causes navbar to change color

Open feruzm opened this issue 5 years ago • 3 comments

Is there way to force color change to stay unless you change it manually again?

Right now, it has been inconsistent, if modal or popover, dropdown modals are opened, they usually have background overlay, cannot figure out how to make color stay and don't get affected by modals.

Any ideas or suggestions?

feruzm avatar Jan 29 '20 10:01 feruzm

Dealing with the same issue.

sergchernata avatar Mar 31 '20 15:03 sergchernata

This is a well-known issue. Follow the guide for this article and it should help resolve things for you:

https://github.com/mockingbot/react-native-immersive#restore-immersive-state

crutchcorn avatar Apr 15 '20 03:04 crutchcorn

I had this problem in android. What I believe is happening is the react-native modal is simply taking the default android:navigationBarColor and every time it pops up, it overwrites the current navigation bar color until it gets dismissed.

The flag statusBarTranslucent was not working for me.

I was able to fix this by navigating to res/values/styles.xml

Then in the AppTheme style I added navigationBarColor to be transparent. It looks like this

 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:textColor">@android:color/black</item>
    <item name="android:navigationBarColor">@android:color/transparent</item> // <----This is what I added
  </style>

Then in my react native code, I am able to call

import changeNavigationBarColor from "react-native-navigation-bar-color";

  const setDarkMode = (isDarkMode: boolean) => {
    // logic to change my apps theme to dark mode
    changeNavigationBarColor(isDarkMode ? "black" : "white"); // Then I change the navigation bar color.
  };

ucheNkadiCode avatar Jan 08 '23 06:01 ucheNkadiCode