Skip to content

Commit

Permalink
Add the ability to override android:windowLightNavigationBar
Browse files Browse the repository at this point in the history
  • Loading branch information
zoontek committed Jan 19, 2025
1 parent e78ad83 commit 474df0a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-edge-to-edge",
"version": "1.4.0",
"version": "1.4.1",
"license": "MIT",
"description": "Effortlessly enable edge-to-edge display in React Native",
"author": "Mathieu Acthernoene <zoontek@gmail.com>",
Expand Down
26 changes: 22 additions & 4 deletions src/expo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,14 @@ const withAndroidEdgeToEdgeTheme: ConfigPlugin<Props> = (
]);

return withAndroidStyles(config, (config) => {
const { androidStatusBar = {}, userInterfaceStyle = "light" } = config;
const { barStyle } = androidStatusBar;
const {
androidNavigationBar = {},
androidStatusBar = {},
userInterfaceStyle = "light",
} = config;

const { barStyle: navigationBarStyle } = androidNavigationBar;
const { barStyle: statusBarStyle } = androidStatusBar;
const { android = {} } = props;
const { enforceNavigationBarContrast, parentTheme = "Default" } = android;

Expand All @@ -76,17 +82,29 @@ const withAndroidEdgeToEdgeTheme: ConfigPlugin<Props> = (
});
}

if (barStyle != null) {
if (statusBarStyle != null) {
style.item.push({
$: { name: "android:windowLightStatusBar" },
_: String(barStyle === "dark-content"),
_: String(statusBarStyle === "dark-content"),
});
} else if (userInterfaceStyle !== "automatic") {
style.item.push({
$: { name: "android:windowLightStatusBar" },
_: String(userInterfaceStyle === "light"),
});
}

if (navigationBarStyle != null) {
style.item.push({
$: { name: "android:windowLightNavigationBar" },
_: String(navigationBarStyle === "dark-content"),
});
} else if (userInterfaceStyle !== "automatic") {
style.item.push({
$: { name: "android:windowLightNavigationBar" },
_: String(navigationBarStyle === "light"),
});
}
}

return style;
Expand Down

0 comments on commit 474df0a

Please sign in to comment.