Skip to content

Commit 7b80de6

Browse files
committed
Skip updateEntriesStack on platform others than android and ios
1 parent 490be42 commit 7b80de6

File tree

2 files changed

+47
-45
lines changed

2 files changed

+47
-45
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-edge-to-edge",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"license": "MIT",
55
"description": "Effortlessly enable edge-to-edge display in React Native",
66
"author": "Mathieu Acthernoene <[email protected]>",

src/SystemBars.ts

+46-44
Original file line numberDiff line numberDiff line change
@@ -74,54 +74,56 @@ let currentMergedEntries: {
7474
* Updates the native system bars with the entries from the stack.
7575
*/
7676
function updateEntriesStack() {
77-
if (updateImmediate != null) {
78-
clearImmediate(updateImmediate);
79-
}
77+
if (Platform.OS === "android" || Platform.OS === "ios") {
78+
if (updateImmediate != null) {
79+
clearImmediate(updateImmediate);
80+
}
8081

81-
updateImmediate = setImmediate(() => {
82-
const mergedEntries = mergeEntriesStack(entriesStack);
83-
84-
if (mergedEntries != null) {
85-
const { statusBarHidden, navigationBarHidden } = mergedEntries;
86-
87-
const statusBarStyle: "light" | "dark" | undefined =
88-
mergedEntries.statusBarStyle === "auto"
89-
? getColorScheme() === "light"
90-
? "dark"
91-
: "light"
92-
: mergedEntries.statusBarStyle;
93-
94-
if (
95-
currentMergedEntries?.statusBarStyle !== statusBarStyle ||
96-
currentMergedEntries?.statusBarHidden !== statusBarHidden ||
97-
currentMergedEntries?.navigationBarHidden !== navigationBarHidden
98-
) {
99-
if (Platform.OS === "android") {
100-
NativeEdgeToEdgeModule?.setSystemBarsConfig({
101-
statusBarStyle,
102-
statusBarHidden,
103-
navigationBarHidden,
104-
});
105-
} else if (Platform.OS === "ios") {
106-
// Emulate android behavior with react-native StatusBar
107-
if (statusBarStyle != null) {
108-
StatusBar.setBarStyle(`${statusBarStyle}-content`, true);
109-
}
110-
if (statusBarHidden != null) {
111-
StatusBar.setHidden(statusBarHidden, "fade"); // 'slide' doesn't work in this context
82+
updateImmediate = setImmediate(() => {
83+
const mergedEntries = mergeEntriesStack(entriesStack);
84+
85+
if (mergedEntries != null) {
86+
const { statusBarHidden, navigationBarHidden } = mergedEntries;
87+
88+
const statusBarStyle: "light" | "dark" | undefined =
89+
mergedEntries.statusBarStyle === "auto"
90+
? getColorScheme() === "light"
91+
? "dark"
92+
: "light"
93+
: mergedEntries.statusBarStyle;
94+
95+
if (
96+
currentMergedEntries?.statusBarStyle !== statusBarStyle ||
97+
currentMergedEntries?.statusBarHidden !== statusBarHidden ||
98+
currentMergedEntries?.navigationBarHidden !== navigationBarHidden
99+
) {
100+
if (Platform.OS === "android") {
101+
NativeEdgeToEdgeModule?.setSystemBarsConfig({
102+
statusBarStyle,
103+
statusBarHidden,
104+
navigationBarHidden,
105+
});
106+
} else {
107+
// Emulate android behavior with react-native StatusBar
108+
if (statusBarStyle != null) {
109+
StatusBar.setBarStyle(`${statusBarStyle}-content`, true);
110+
}
111+
if (statusBarHidden != null) {
112+
StatusBar.setHidden(statusBarHidden, "fade"); // 'slide' doesn't work in this context
113+
}
112114
}
113115
}
114-
}
115116

116-
currentMergedEntries = {
117-
statusBarStyle,
118-
statusBarHidden,
119-
navigationBarHidden,
120-
};
121-
} else {
122-
currentMergedEntries = null;
123-
}
124-
});
117+
currentMergedEntries = {
118+
statusBarStyle,
119+
statusBarHidden,
120+
navigationBarHidden,
121+
};
122+
} else {
123+
currentMergedEntries = null;
124+
}
125+
});
126+
}
125127
}
126128

127129
/**

0 commit comments

Comments
 (0)