Skip to content

Commit efecb97

Browse files
1 parent b9bdcb4 commit efecb97

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/routes/__root.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import useUIModeStore from '../store/uiModeStore';
55
import { themeChange } from 'theme-change';
66
import { useTranslation } from 'react-i18next';
77
import { StatusBar, Style } from '@capacitor/status-bar';
8+
import { AndroidEdgeToEdgeSupport } from '@capawesome/capacitor-android-edge-to-edge-support';
89

910
export const Route = createRootRoute({
1011
component: RootComponent,
@@ -29,13 +30,18 @@ function isDarkTheme(theme: string) {
2930
async function applyStatusBarForTheme(theme: string) {
3031
const dark = isDarkTheme(theme);
3132

32-
if (dark) {
33-
await StatusBar.setBackgroundColor({ color: '#020617' });
34-
await StatusBar.setStyle({ style: Style.Light });
35-
} else {
36-
await StatusBar.setBackgroundColor({ color: '#f9fafb' });
37-
await StatusBar.setStyle({ style: Style.Dark });
38-
}
33+
const darkColor = '#020617';
34+
const lightColor = '#f9fafb';
35+
36+
await AndroidEdgeToEdgeSupport.enable();
37+
38+
await AndroidEdgeToEdgeSupport.setBackgroundColor({
39+
color: dark ? darkColor : lightColor,
40+
});
41+
42+
await StatusBar.setStyle({
43+
style: dark ? Style.Light : Style.Dark,
44+
});
3945

4046
await StatusBar.setOverlaysWebView({ overlay: false });
4147
}

0 commit comments

Comments
 (0)