-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
48 lines (40 loc) · 1.17 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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import { Provider, connect } from 'react-redux';
import { createStore, bindActionCreators } from 'redux';
import { addNavigationHelpers, StackNavigator } from 'react-navigation';
import { appReducer } from './app/reducers/reducers';
import { AppRoutes } from './app/config/Routes';
import * as actionCreators from './app/actions/actions';
import devToolsEnhancer from 'remote-redux-devtools';
class NavigatorApp extends Component {
render() {
return (
<AppRoutes
navigation={addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.nav,
})}
/>
);
}
}
const mapStateToProps = state => ({
nav: state.nav,
});
export const AppWithNavigationState = connect(mapStateToProps)(NavigatorApp);
export const store = createStore(appReducer, devToolsEnhancer());
export default class App extends Component {
render() {
return (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
);
}
}