-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
50 lines (42 loc) · 1.34 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
import React, { useEffect, useState } from 'react'
import { StatusBar } from 'react-native'
import { AppLoading } from 'expo'
import { Provider } from 'react-redux'
import { applyMiddleware, createStore } from 'redux'
import thunk from 'redux-thunk'
import * as Font from 'expo-font'
import { ThemeProvider } from 'styled-components/native'
import reducer, { initialState } from './src/store/reducer'
import MainNavigator from './src/navigation/MainNavigator'
import { lightTheme } from './src/styles/theme'
const store = createStore(reducer, initialState, applyMiddleware(thunk))
export default function App() {
const [isLoadingComplete, setLoadingComplete] = useState(false)
useEffect(() => {
async function loadResourcesAndDataAsync() {
try {
// Load fonts
await Font.loadAsync({
poppins: require('./assets/fonts/Poppins-Regular.ttf'),
poppinsbold: require('./assets/fonts/Poppins-Bold.ttf')
})
} catch (e) {
console.warn(e)
} finally {
setLoadingComplete(true)
}
}
loadResourcesAndDataAsync()
}, [])
if (!isLoadingComplete) {
return <AppLoading />
}
return (
<Provider store={store}>
<ThemeProvider theme={lightTheme}>
<StatusBar barStyle="dark-content" />
<MainNavigator />
</ThemeProvider>
</Provider>
)
}