-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
44 lines (36 loc) · 1.11 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
import React, { Component } from 'react';
import { StyleSheet, StatusBar } from 'react-native';
import {
createReduxContainer,
createReactNavigationReduxMiddleware
} from 'react-navigation-redux-helpers';
import { createStore, applyMiddleware } from 'redux';
import { Provider, connect } from 'react-redux';
import AppContainter from './src';
import appReducer from './src/reducer';
const middleware = createReactNavigationReduxMiddleware(state => state.nav);
const AppReduxContainer = createReduxContainer(AppContainter);
const mapStateToProps = state => ({
state: state.nav,
});
const AppWithNavigationState = connect(mapStateToProps)(AppReduxContainer);
const store = createStore(appReducer, applyMiddleware(middleware));
class App extends Component {
componentDidMount() {
StatusBar.setBackgroundColor('rgb(29,216,200)');
}
render() {
return (
<Provider store={store} style={styles.container}>
<StatusBar barStyle="light-content" />
<AppWithNavigationState />
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default App;