-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
executable file
·51 lines (45 loc) · 1.4 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
import {theme} from 'configs/themeConfig';
import * as Font from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import store from 'features/store';
import React, {useEffect, useState} from 'react';
import FlashMessage from 'react-native-flash-message';
import 'react-native-gesture-handler';
import {Provider as PaperProvider} from 'react-native-paper';
import {Provider as StoreProvider} from 'react-redux';
import RootStack from 'routes/RootStack';
const App = (): JSX.Element | null => {
const [appIsReady, setAppIsReady] = useState(false);
const fontConfig = {
'Quicksand-regular': require('./src/assets/fonts/Quicksand_regular.ttf'),
'Quicksand-bold': require('./src/assets/fonts/Quicksand_bold.ttf'),
'Quicksand-medium': require('./src/assets/fonts/Quicksand_medium.ttf'),
};
const prepareApp = async () => {
try {
await SplashScreen.preventAutoHideAsync();
await Font.loadAsync(fontConfig);
} catch (error) {
console.warn(error);
} finally {
setAppIsReady(true);
await SplashScreen.hideAsync();
}
};
useEffect(() => {
prepareApp();
}, []);
if (!appIsReady) {
return null;
} else {
return (
<StoreProvider store={store}>
<PaperProvider theme={theme}>
<RootStack />
</PaperProvider>
<FlashMessage position="top" />
</StoreProvider>
);
}
};
export default App;