-
Notifications
You must be signed in to change notification settings - Fork 2
/
App.js
38 lines (33 loc) · 948 Bytes
/
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
import React, {Component} from 'react'
import {connect, Provider} from 'react-redux'
import {createStore, applyMiddleware} from 'redux'
import {
createReactNavigationReduxMiddleware,
reduxifyNavigator
} from 'react-navigation-redux-helpers'
import {createLogger} from 'redux-logger'
import thunk from 'redux-thunk'
import AppNavigator from './config/routes/routes'
import rootReducer from './reducers'
const middleware = createReactNavigationReduxMiddleware(
'root',
state => state.nav
)
const App = reduxifyNavigator(AppNavigator, 'root')
const mapStateToProps = state => ({
state: state.nav
})
const AppWithNavigationState = connect(mapStateToProps)(App)
const store = createStore(
rootReducer,
applyMiddleware(middleware, thunk, __DEV__ && createLogger())
)
export default class Root extends Component {
render() {
return (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
)
}
}