-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
46 lines (40 loc) · 1.17 KB
/
App.js
File metadata and controls
46 lines (40 loc) · 1.17 KB
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
import React, { useState } from 'react'
import { Platform, StatusBar } from 'react-native'
import { AppLoading } from 'expo'
import * as Font from 'expo-font'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import reducer from './src/reducers/reducer'
import AppNavigator from './src/navigation/AppNavigator'
const store = createStore(reducer)
const App = () => {
const [isLoadingComplete, setLoadingComplete] = useState(false)
if (!isLoadingComplete) {
return (
<AppLoading
startAsync={loadResourcesAsync}
onError={handleLoadingError}
onFinish={() => setLoadingComplete(true)}
/>
)
} else {
return (
<Provider store={store}>
{Platform.OS === 'ios' && <StatusBar barStyle='default' />}
<AppNavigator />
</Provider>
)
}
}
export default App
async function loadResourcesAsync () {
await Promise.all([
Font.loadAsync({
'covered-by-your-grace': require('./src/assets/fonts/CoveredByYourGrace-Regular.ttf'),
'patrick-hand-sc': require('./src/assets/fonts/PatrickHandSC-Regular.ttf')
})
])
}
function handleLoadingError (error) {
console.warn(error)
}