-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
61 lines (52 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
52
53
54
55
56
57
58
59
60
61
import React, { Component } from 'react'
import { View, Text } from 'react-native'
import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import { Provider } from 'react-redux'
import { Notifications, Font } from 'expo'
import MainNavigator from './utils/MainNavigator'
import Reducers from './utils/Reducers'
import { SET_INIT } from './ducks/InitState'
const store = createStore(
Reducers,
applyMiddleware(thunk)
)
store.dispatch(SET_INIT())
class App extends Component {
constructor(props) {
super(props)
this.state = {
loadFont: false
}
}
componentWillMount() {
this._notificationSubscription = Notifications.addListener(this._handleNotification)
}
async componentDidMount() {
await Font.loadAsync({
'Kanit': require('./src/fonts/Kanit-Regular.ttf'),
})
this.setState({ loadFont: true })
}
_handleNotification = (notification) => {
console.log('notification : ', notification)
}
render() {
return (
<Provider store={store}>
{ this.state.loadFont
? <MainNavigator />
: <View
style={{
flex: 1,
alignItems: 'center'
}}
>
<Text>loading font</Text>
</View>
}
</Provider>
)
}
}
export default App