-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathApp.js
61 lines (49 loc) · 1.58 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 * as React from 'react';
import { AppLoading } from 'expo';
import * as Font from 'expo-font';
import { Ionicons } from '@expo/vector-icons';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';
import { StyleProvider } from 'native-base';
import { StatusBar, Platform } from 'react-native';
import getTheme from '@assets/native-base-theme/components';
import theme from '@assets/native-base-theme/variables/commonColor';
import configureStore from '@app/store';
import Loading from '@components/loading/Loading';
import Dashboard from '@components/dashboard/Dashboard';
const { persistor, store } = configureStore();
if (Platform.OS === 'android') StatusBar.setHidden(true);
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isReady: false,
};
}
async componentDidMount() {
await this.loadFonts();
}
async loadFonts() {
await Font.loadAsync({
Roboto: require('native-base/Fonts/Roboto.ttf'),
Roboto_medium: require('native-base/Fonts/Roboto_medium.ttf'),
Questrial: require('@assets/fonts/Questrial.ttf'),
...Ionicons.font,
});
this.setState({ isReady: true });
}
render() {
if (!this.state.isReady) {
return <AppLoading></AppLoading>;
}
return (
<Provider store={store}>
<PersistGate loading={<Loading />} persistor={persistor}>
<StyleProvider style={getTheme(theme)}>
<Dashboard />
</StyleProvider>
</PersistGate>
</Provider>
);
}
}