Environment
react-native-system-navigation-bar: 3.0.0
- React Native: 0.85.0
- AndroidX Core resolved by the app: 1.18.0
- Device: Xiaomi Mi 10S, Android 12 / API 31
targetSdkVersion: 36
Reproduction
- Render content behind a transparent status bar.
- Call
setBarStyle('dark', 'status') so the light background uses dark status-bar icons.
- Remove the app from recents and launch it again from the launcher.
On this device the icons become white after relaunch. The same sequence did not reproduce on an Android emulator.
Expected behavior
The status-bar icons remain dark after setBarStyle('dark', 'status') resolves.
Actual behavior and diagnostics
The promise resolves, and WindowInsetsControllerCompat.isAppearanceLightStatusBars reads back true, but the icons remain white.
WindowManager showed only the legacy flag:
vsysui=... LIGHT_STATUS_BAR
The app window did not have the corresponding modern appearance:
The readback is therefore a false positive on this path. AndroidX's API 30 implementation reads and writes systemUiVisibility whenever the compat controller was constructed with a Window, which is the path used by WindowCompat.getInsetsController(window, window.decorView):
https://github.com/androidx/androidx/blob/androidx-main/core/core/src/main/java/androidx/core/view/WindowInsetsControllerCompat.java#L660-L710
React Native's Android 12+ status-bar implementation instead calls the platform WindowInsetsController.setSystemBarsAppearance API directly:
https://github.com/facebook/react-native/blob/v0.85.0/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt#L125-L160
Proposed fix
For API levels above Android 11, use window.insetsController.setSystemBarsAppearance(...) directly with a mask for the requested status/navigation bar. Keep the current compat implementation on Android 11 and below.
I tested that change on the affected Xiaomi device. The same remove-from-recents and launcher-reopen sequence produced:
and the icons remained dark through two fresh-process relaunches. Calls targeting only the status bar continued to leave the navigation-bar appearance untouched.
I can send a focused PR with this change.
Environment
react-native-system-navigation-bar: 3.0.0targetSdkVersion: 36Reproduction
setBarStyle('dark', 'status')so the light background uses dark status-bar icons.On this device the icons become white after relaunch. The same sequence did not reproduce on an Android emulator.
Expected behavior
The status-bar icons remain dark after
setBarStyle('dark', 'status')resolves.Actual behavior and diagnostics
The promise resolves, and
WindowInsetsControllerCompat.isAppearanceLightStatusBarsreads backtrue, but the icons remain white.WindowManager showed only the legacy flag:
The app window did not have the corresponding modern appearance:
The readback is therefore a false positive on this path. AndroidX's API 30 implementation reads and writes
systemUiVisibilitywhenever the compat controller was constructed with aWindow, which is the path used byWindowCompat.getInsetsController(window, window.decorView):https://github.com/androidx/androidx/blob/androidx-main/core/core/src/main/java/androidx/core/view/WindowInsetsControllerCompat.java#L660-L710
React Native's Android 12+ status-bar implementation instead calls the platform
WindowInsetsController.setSystemBarsAppearanceAPI directly:https://github.com/facebook/react-native/blob/v0.85.0/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.kt#L125-L160
Proposed fix
For API levels above Android 11, use
window.insetsController.setSystemBarsAppearance(...)directly with a mask for the requested status/navigation bar. Keep the current compat implementation on Android 11 and below.I tested that change on the affected Xiaomi device. The same remove-from-recents and launcher-reopen sequence produced:
and the icons remained dark through two fresh-process relaunches. Calls targeting only the status bar continued to leave the navigation-bar appearance untouched.
I can send a focused PR with this change.