-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
48 lines (41 loc) · 1.29 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
import React, { useCallback } from "react";
import { View } from "react-native";
import { ThemeProvider } from "styled-components";
import { StatusBar } from "expo-status-bar";
import * as SplashScreen from "expo-splash-screen";
import { useFonts } from "expo-font";
import { Inter_400Regular, Inter_500Medium } from "@expo-google-fonts/inter";
import { Roboto_700Bold, Roboto_500Medium } from "@expo-google-fonts/roboto";
import theme from "./src/theme/index";
import { Routes } from "./src/routes";
import { NavigationContainer } from "@react-navigation/native";
export default function App() {
const [fontsLoaded] = useFonts({
Inter_400Regular,
Inter_500Medium,
Roboto_700Bold,
Roboto_500Medium,
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
// Hide the splash screen
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<NavigationContainer>
<ThemeProvider theme={theme}>
<View
onLayout={onLayoutRootView}
style={{ flex: 1, alignItems: "center", justifyContent: "center" }}
>
<StatusBar backgroundColor="transparent" translucent={true} />
<Routes />
</View>
</ThemeProvider>
</NavigationContainer>
);
}