-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
52 lines (45 loc) · 1.74 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 "./src/application/settings/initializeAppInternationalization";
import "react-native-reanimated";
import "react-native-gesture-handler";
import { DarkTheme, NavigationContainer } from "@react-navigation/native";
import { useFonts } from "expo-font";
import { StatusBar } from "expo-status-bar";
import * as React from "react";
import { View } from "react-native";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import { initializeAppSettings } from "~/application/settings/initializeAppSettings";
import { orientationLock } from "~/application/settings/orientationLock";
import { splashScreen } from "~/application/settings/splashHide";
import { AlertModal } from "~/presentation/components/AlertModal";
import { RootStack } from "~/presentation/routes/RootStack";
import { colors } from "~/presentation/settings/themes";
export default function App() {
const [fontsLoaded] = useFonts({
"Figtree-Regular": require("./assets/fonts/Figtree-Regular.ttf"),
"Figtree-Medium": require("./assets/fonts/Figtree-Medium.ttf"),
"Figtree-Bold": require("./assets/fonts/Figtree-Bold.ttf"),
});
React.useEffect(() => {
initializeAppSettings();
}, []);
const onLayoutRootView = React.useCallback(async () => {
if (fontsLoaded) {
await orientationLock();
await splashScreen().hide();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<View style={{ flex: 1, backgroundColor: colors.black_100 }} onLayout={onLayoutRootView}>
<GestureHandlerRootView style={{ flex: 1 }}>
<NavigationContainer theme={DarkTheme}>
<StatusBar backgroundColor={colors.transparent} style="light" translucent />
<RootStack />
<AlertModal />
</NavigationContainer>
</GestureHandlerRootView>
</View>
);
}