This repository has been archived by the owner on May 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
App.js
82 lines (70 loc) · 2.2 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React, { Component } from 'react';
import { StatusBar } from 'react-native';
import { Root } from "native-base";
import { Font, AppLoading } from "expo";
import thunk from 'redux-thunk'
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { createLogger } from 'redux-logger';
// import App from './src/App';
import MainNavigation from './src/navagation/MainNavigation';
import allReducers from './src/reducers';
const logger = createLogger();
const store = createStore(allReducers, applyMiddleware(logger, thunk));
// export default () => <App/>;
export default class RootApp extends Component {
constructor(props) {
super(props);
this.state = {
loaded: false
};
}
// async componentWillMount() {
// console.log('Run App!!!');
// await this.loadAssets();
// this.setState({ loaded: true });
// }
handleError = (error) => console.log(error);
handleLoaded = () => this.setState({ loaded: true });
loadAssets = async() => {
// Font Preloading
await Font.loadAsync({
Roboto: require("native-base/Fonts/Roboto.ttf"),
Roboto_medium: require("native-base/Fonts/Roboto_medium.ttf"),
'Sweet Sensations Persona Use': require('./assets/Sweet_Sensations_Persona_Use.ttf'),
'Noto Sans KR': require('./assets/NotoSansKR-Regular.otf'),
'Noto Sans KR Bold': require('./assets/NotoSansKR-Bold.otf'),
'Noto Serif KR': require('./assets/NotoSerifKR-Regular.otf'),
'Noto Serif KR Bold': require('./assets/NotoSerifKR-Bold.otf'),
});
// Images Preloading
// await Asset.loadAsync([
// require("./assets/icon.png")
// ])
console.log('loadAssets complete!!!');
}
render() {
const { loaded } = this.state;
return (
<>
<StatusBar
backgroundColor="white"
barStyle="dark-content"/>
{
(loaded)
?
<Root>
<Provider store={ store }>
<MainNavigation/>
</Provider>
</Root>
:
<AppLoading
startAsync={this.loadAssets}
onFinish={this.handleLoaded}
onError={this.handleError} />
}
</>
);
}
}