-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
63 lines (51 loc) · 1.46 KB
/
App.js
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
59
60
61
62
63
import FontAwesome from '@expo/vector-icons/FontAwesome';
import { useFonts } from 'expo-font';
import { SplashScreen } from 'expo-router';
import { useEffect } from 'react';
import { RecoilRoot } from 'recoil';
import { useColorScheme, StyleSheet, Text, View } from 'react-native';
import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native';
// import Toast from 'react-native-toast-message';
import AppContainer from '@navigations';
import { Loading } from '@components';
import { Images, Fonts, Colors, Themes } from '@constants';
SplashScreen.preventAutoHideAsync();
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
export default function App() {
const colorScheme = useColorScheme();
const [loaded, error] = useFonts({
SpaceMono: require('@assets/fonts/SpaceMono-Regular.ttf'),
...FontAwesome.font,
});
useEffect(() => {
if (error) throw error;
}, [error]);
useEffect(() => {
if (loaded) {
SplashScreen.hideAsync();
}
}, [loaded]);
if (!loaded) {
return null;
}
return (
<RecoilRoot>
<ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}>
<AppContainer />
<Loading />
{/* <Toast /> */}
</ThemeProvider>
</RecoilRoot>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.white,
alignItems: 'center',
justifyContent: 'center',
},
});