forked from sync-for-science/discovery-mobile-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
51 lines (44 loc) · 1.32 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
import React, { useState, useEffect, Suspense } from 'react';
import { RecoilRoot } from 'recoil';
import {
LogBox, View, ActivityIndicator, StyleSheet,
} from 'react-native';
import * as Font from 'expo-font'; // eslint-disable-line import/no-extraneous-dependencies
import { Ionicons } from '@expo/vector-icons'; // eslint-disable-line import/no-extraneous-dependencies
import Roboto from 'native-base/Fonts/Roboto.ttf';
import Roboto_medium from 'native-base/Fonts/Roboto_medium.ttf'; // eslint-disable-line camelcase
import RootNavigator from './src/navigation/RootNavigator';
LogBox.ignoreLogs(['VirtualizedLists', 'A VirtualizedList']);
export default function App() {
const [loading, setLoading] = useState(false);
useEffect(() => {
setLoading(true);
const loadFonts = async () => {
await Font.loadAsync({
Roboto,
Roboto_medium,
...Ionicons.font,
});
};
loadFonts();
setLoading(false);
}, []);
if (loading) {
return (<View />);
}
return (
<RecoilRoot>
<Suspense fallback={<View style={styles.fallbackContainer}><ActivityIndicator /></View>}>
<RootNavigator />
</Suspense>
</RecoilRoot>
);
}
const styles = StyleSheet.create({
fallbackContainer: {
flex: 1,
justifyContent:
'center',
alignItems: 'center',
},
});