-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathApp.tsx
41 lines (39 loc) · 1.52 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
import "react-native-gesture-handler";
import { StatusBar } from "expo-status-bar";
import { StyleSheet, Text, View } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import * as SplashScreen from "expo-splash-screen";
import { useFonts } from "expo-font";
import { useCallback } from "react";
import { GestureHandlerRootView } from "react-native-gesture-handler";
import Home from "./screens/Home";
import BasicAnimations from "./screens/BasicAnimations";
import RootNavigator from "./navigators/RootNavigator";
import { NavigationContainer } from "@react-navigation/native";
import { WeatherDataProvider } from "./context/WeatherDataContext";
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded] = useFonts({
"SF-Thin": require("./assets/fonts/SF-Pro-Display-Thin.otf"),
"SF-Regular": require("./assets/fonts/SF-Pro-Display-Regular.otf"),
"SF-Semibold": require("./assets/fonts/SF-Pro-Display-Semibold.otf"),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) return null;
return (
<SafeAreaProvider onLayout={onLayoutRootView}>
<WeatherDataProvider>
<GestureHandlerRootView style={{ flex: 1 }}>
<NavigationContainer>
<RootNavigator />
</NavigationContainer>
<StatusBar style="light" />
</GestureHandlerRootView>
</WeatherDataProvider>
</SafeAreaProvider>
);
}