Open mcritter42 opened 1 year ago
Hi, @mcritter42 – The issue you're experiencing is due to a change in the Android APIs. The method used by this library to change the nav bar icons from light to dark doesn't seem to work for API level 30 (Android 11) or greater.
I was able to fix the issue by applying the following patch:
diff --git a/node_modules/react-native-navigation-bar-color/android/src/main/java/com/thebylito/navigationbarcolor/NavigationBarColorModule.java b/node_modules/react-native-navigation-bar-color/android/src/main/java/com/thebylito/navigationbarcolor/NavigationBarColorModule.java
index b3edac7..fe7602c 100644
--- a/node_modules/react-native-navigation-bar-color/android/src/main/java/com/thebylito/navigationbarcolor/NavigationBarColorModule.java
+++ b/node_modules/react-native-navigation-bar-color/android/src/main/java/com/thebylito/navigationbarcolor/NavigationBarColorModule.java
@@ -11,6 +11,7 @@ import android.app.Activity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import android.view.WindowInsetsController;
import androidx.annotation.UiThread;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
@@ -44,6 +45,17 @@ public class NavigationBarColorModule extends ReactContextBaseJavaModule {
}
public void setNavigationBarTheme(Activity activity, Boolean light) {
+ if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ Window window = activity.getWindow();
+ int lightNavBarFlag = WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
+ if (light) {
+ window.getDecorView().getWindowInsetsController().setSystemBarsAppearance(lightNavBarFlag, lightNavBarFlag);
+ } else {
+ window.getDecorView().getWindowInsetsController().setSystemBarsAppearance(0, lightNavBarFlag);
+ }
+ return;
+ }
+
if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Window window = activity.getWindow();
int flags = window.getDecorView().getSystemUiVisibility();
@thebylito – I'm happy to submit a PR for this change if you're interested in doing a new release. Just let me know.
on version 2.0.2 the light flag nor the animated flag are working as expected, would always revert to the defaults. experienced on android 13 pixel 6 using react-native 0.70.6.
changeNavigationBarColor( '#FFFFFF', true true, );