-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
58 lines (51 loc) · 1.73 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
53
54
55
56
57
58
import CustomStatusBar from "@components/CustomStatusBar";
import WebviewContainer from "@components/container/WebViewContainer";
import { Fragment, useCallback } from "react";
import { NavigationContainer } from "@react-navigation/native";
import AppBase from "navigators/AppBase";
import { useFonts } from "expo-font";
import * as SplashScreen from "expo-splash-screen";
import { Text, View } from "react-native";
import * as Linking from "expo-linking";
import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
import { useAtom } from "jotai";
import { safeAreaAtom } from "datas/atoms";
if (__DEV__) {
require("./ReactotronConfig");
}
const prefix = Linking.createURL("/");
export default function App() {
const [fontsLoaded, fontError] = useFonts({
Medium: require("./assets/font/Pretendard-Medium.otf"),
Regular: require("./assets/font/Pretendard-Regular.otf"),
Bold: require("./assets/font/Pretendard-Bold.otf"),
SCDream: require("./assets/font/SCDream-Bold.otf"),
});
const [safearea] = useAtom(safeAreaAtom);
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded || fontError) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded, fontError]);
if (!fontsLoaded && !fontError) {
return null;
}
const linking = {
prefixes: [prefix],
config: {
screens: {
ManageNav: "manage/:storeId",
},
},
};
return (
<SafeAreaProvider>
<SafeAreaView onLayout={onLayoutRootView} style={{ flex: 1 }} edges={safearea}>
<CustomStatusBar />
<NavigationContainer linking={linking} fallback={<Text>로딩 중..</Text>}>
<AppBase />
</NavigationContainer>
</SafeAreaView>
</SafeAreaProvider>
);
}