-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
52 lines (46 loc) · 1.7 KB
/
App.tsx
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
49
50
51
52
import { ThemeProvider } from "styled-components/native";
import { StatusBar } from "expo-status-bar";
import "react-native-gesture-handler";
import { Provider } from "react-native-paper";
import useCachedResources from "./hooks/useCachedResources";
import useColorScheme from "./hooks/useColorScheme";
import { Navigation } from "./navigation";
import { darkTheme } from "./theme/dark/theme";
import { defaultTheme } from "./theme/default/theme";
import "./firebase";
import { StatusBarProvider } from "./utils/providers/StatusBarProvider";
import { useSystemAccentColor } from "./utils/useSystemAccentColor";
import { Environment } from "./utils/Environment";
import { ScreenProvider } from "./components";
import { GestureHandlerRootView } from "react-native-gesture-handler";
export default function App() {
const isLoadingComplete = useCachedResources();
const colorScheme = useColorScheme();
const systemAccentColor = useSystemAccentColor();
if (systemAccentColor) {
const color = systemAccentColor;
darkTheme.colors.primary = color;
defaultTheme.colors.primary = color;
}
if (!isLoadingComplete) {
return null;
} else {
return (
<ScreenProvider>
<GestureHandlerRootView style={{flex: 1}}>
<ThemeProvider
theme={colorScheme === "dark" ? darkTheme : defaultTheme}
>
<StatusBarProvider>
<Provider>
<Environment />
<StatusBar style={colorScheme === "dark" ? "light" : "dark"} />
<Navigation colorScheme={colorScheme} />
</Provider>
</StatusBarProvider>
</ThemeProvider>
</GestureHandlerRootView>
</ScreenProvider>
);
}
}