Skip to content

Commit 00659a1

Browse files
authored
fix(android): status bar style handling for API 30+ (#11102)
1 parent 4da6238 commit 00659a1

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

packages/core/ui/core/view/index.android.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,22 +1329,24 @@ export class View extends ViewCommon {
13291329
const decorView = window.getDecorView();
13301330

13311331
// API 30+ path (preferred)
1332-
const controller = window.getInsetsController?.();
1333-
if (controller && SDK_VERSION >= 30) {
1334-
const APPEARANCE_LIGHT_STATUS_BARS = android.view.WindowInsetsController?.APPEARANCE_LIGHT_STATUS_BARS;
1335-
1336-
if (typeof value === 'string') {
1337-
this.style.statusBarStyle = value;
1338-
if (value === 'light') {
1339-
// light icons/text
1340-
controller.setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS);
1332+
if (SDK_VERSION >= 30) {
1333+
const controller = window.getInsetsController?.();
1334+
if (controller) {
1335+
const APPEARANCE_LIGHT_STATUS_BARS = android.view.WindowInsetsController?.APPEARANCE_LIGHT_STATUS_BARS;
1336+
1337+
if (typeof value === 'string') {
1338+
this.style.statusBarStyle = value;
1339+
if (value === 'light') {
1340+
// light icons/text
1341+
controller.setSystemBarsAppearance(0, APPEARANCE_LIGHT_STATUS_BARS);
1342+
} else {
1343+
// dark icons/text
1344+
controller.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS);
1345+
}
13411346
} else {
1342-
// dark icons/text
1343-
controller.setSystemBarsAppearance(APPEARANCE_LIGHT_STATUS_BARS, APPEARANCE_LIGHT_STATUS_BARS);
1347+
if (value.color != null) window.setStatusBarColor(value.color);
1348+
// No direct passthrough for systemUiVisibility on API 30+, use appearances instead
13441349
}
1345-
} else {
1346-
if (value.color != null) window.setStatusBarColor(value.color);
1347-
// No direct passthrough for systemUiVisibility on API 30+, use appearances instead
13481350
}
13491351
return;
13501352
}

0 commit comments

Comments
 (0)