-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
53 lines (44 loc) · 1.61 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
import { AppLoading } from 'expo'
import { Asset } from 'expo-asset'
import { loadAsync as loadFont } from 'expo-font'
import Constants from 'expo-constants'
import { Ionicons } from '@expo/vector-icons'
import React, { useState } from 'react'
import { StatusBar } from 'react-native'
import { Container, View, Root } from 'native-base'
import AppContainer from './navigation/AppContainer'
import Components from './components'
const App = ({ skipLoadingScreen }) => {
const [isLoadingComplete, setLoadingComplete] = useState(false)
if (!isLoadingComplete && !skipLoadingScreen) {
return <AppLoading startAsync={loadResourcesAsync} onError={handleError} onFinish={handleFinishLoading} />
}
async function loadResourcesAsync() {
await Promise.all([
Asset.loadAsync([require('./assets/images/robot-dev.png'), require('./assets/images/robot-prod.png')]),
loadFont({
Roboto: require('native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
...Ionicons.font,
}),
])
}
function handleFinishLoading() {
setLoadingComplete(true)
}
function handleError(error) {
// Log any errors that we encounter while loading resources.
// eslint-disable-next-line no-console
console.error(error)
}
return (
<Components.ReduxProvider>
<Root>
<Container>
<AppContainer />
</Container>
</Root>
</Components.ReduxProvider>
)
}
export default App