Skip to content

fix(android): apply modern system bar appearance on Android 12+ - #81

Merged
kadiraydinli merged 2 commits into
kadiraydinli:mainfrom
huxinhai:agent/android-12-system-bar-appearance
Aug 24, 2026
Merged

fix(android): apply modern system bar appearance on Android 12+#81
kadiraydinli merged 2 commits into
kadiraydinli:mainfrom
huxinhai:agent/android-12-system-bar-appearance

Conversation

@huxinhai

Copy link
Copy Markdown
Contributor

Closes #80

What changed

  • Use the platform WindowInsetsController.setSystemBarsAppearance API on Android 12+.
  • Preserve the existing WindowInsetsControllerCompat path on Android 11 and below.
  • Keep status, navigation, and both isolated through their respective appearance masks.

Why

On an affected Xiaomi Android 12 device, the window-backed compat controller could report light status-bar appearance as enabled while only the legacy systemUiVisibility flag had changed. SystemUI continued to consume the modern WindowManager appearance, so the status-bar icons returned to white after task removal and process restoration.

Calling the platform controller directly on API 31+ matches React Native's current Android status-bar implementation and updates the modern appearance consumed by SystemUI. There are no JavaScript API or default-value changes.

User impact

Apps using setBarStyle('dark', 'status') no longer lose dark status-bar icons during affected OEM task/process transitions.

Validation

  • Node 24.13.0 / Yarn 4.11.0
  • yarn install --immutable
  • yarn typecheck
  • yarn lint
  • yarn test — 2 suites, 44 tests
  • yarn prepare
  • :react-native-system-navigation-bar:compileDebugKotlin --rerun-tasks in the example app
  • :react-native-system-navigation-bar:assembleDebug in the example app
  • Downstream React Native 0.85 DogRelease build and install
  • Xiaomi Mi 10S, Android 12 / API 31: remove from recents, reopen, and process-restoration checks retained apr=LIGHT_STATUS_BARS; no Android or React Native fatal logs

The issue did not reproduce on the Android emulator; the before/after WindowManager evidence was captured on the physical Xiaomi device.

@huxinhai
huxinhai marked this pull request as ready for review August 18, 2026 02:04
Window.getInsetsController() returns null until the decor view is attached
to a ViewRootImpl, so an early setBarStyle call would resolve its promise
without touching the window. Fall through to the WindowInsetsControllerCompat
path in that case, which leaves the legacy flag behind for the platform to
apply on attach, instead of silently doing nothing.
@kadiraydinli
kadiraydinli force-pushed the agent/android-12-system-bar-appearance branch from ee04619 to 72d9a04 Compare August 24, 2026 20:00
@kadiraydinli
kadiraydinli merged commit 3e703fa into kadiraydinli:main Aug 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setBarStyle can miss modern status-bar appearance on Android 12+

2 participants