forked from tonyghiani/trash-walk-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
65 lines (57 loc) · 1.7 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
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import { StyleSheet, View } from 'react-native';
import Expo from 'expo';
import RootNavigator from './navigation/RootNavigator';
import reducers from './reducers';
import { saveState, loadState } from './localStorage';
import { api } from './middlewares/api';
import MontserratRegular from './assets/fonts/Montserrat-Regular.ttf';
import MontserratMedium from './assets/fonts/Montserrat-Medium.ttf';
import MontserratSemiBold from './assets/fonts/Montserrat-SemiBold.ttf';
import MontserratBold from './assets/fonts/Montserrat-Bold.ttf';
import MontserratExtraBold from './assets/fonts/Montserrat-ExtraBold.ttf';
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
/* eslint-disable no-underscore-dangle */
const middleware = [api];
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducers, composeEnhancers(applyMiddleware(...middleware)));
/* eslint-enable */
export default class App extends Component {
constructor() {
super();
this.state = {
isReady: false,
};
}
componentWillMount() {
this.loadFonts();
}
async loadFonts() {
await Expo.Font.loadAsync({
MontserratRegular,
MontserratSemiBold,
MontserratMedium,
MontserratBold,
MontserratExtraBold,
});
this.setState({ isReady: true });
}
render() {
if (!this.state.isReady) {
return <Expo.AppLoading />;
}
return (
<Provider store={store}>
<View style={styles.container}>
<RootNavigator />
</View>
</Provider>
);
}
}