-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.jsx
More file actions
48 lines (44 loc) · 1.48 KB
/
App.jsx
File metadata and controls
48 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import React from "react";
import { useTheme } from "react-native-paper";
import { useColorScheme, StatusBar } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { StateContextProvider, StateContext } from "./src/controllers/state";
import { useIsSmallScreen, isMobile } from "./src/utils/checkPlatform";
import Route from "./src/components/Route";
import themeDark from "./src/theme/themeDark";
import themeLight from "./src/theme/themeLight";
function App() {
const themeh = useTheme();
const colorScheme = useColorScheme();
const isScreenSmall = useIsSmallScreen();
React.useEffect(() => {
if (!isMobile()) {
const root = document.getElementById("root");
if (root) {
if (!isScreenSmall) root.style.overflowY = "hidden";
root.style.backgroundColor = themeh.colors.background;
} else {
console.error("Couldn't get root view to fix web ScrollView.");
}
}
});
return (
<StateContextProvider>
<StatusBar
hidden={false}
backgroundColor={
colorScheme === "dark"
? themeDark.colors.background
: themeLight.colors.background
}
barStyle={colorScheme === "dark" ? "light-content" : "dark-content"}
/>
<SafeAreaProvider>
<StateContext.Consumer>
{({ theme }) => <Route theme={theme} />}
</StateContext.Consumer>
</SafeAreaProvider>
</StateContextProvider>
);
}
export default App;