-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
47 lines (40 loc) · 1.13 KB
/
index.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
import React from "react";
import { Provider } from "react-redux";
import { createStackNavigator } from "react-navigation";
import { createStore, applyMiddleware, combineReducers } from "redux";
import {
reduxifyNavigator,
createReactNavigationReduxMiddleware,
createNavigationReducer
} from "react-navigation-redux-helpers";
import { Welcome, Detail } from "./containers";
import ReduxNavigation from "./ReduxNavigation";
const AppNavigator = createStackNavigator(
{
Welcome: Welcome,
Detail: Detail
},
{
initialRouteName: "Welcome"
}
);
const navReducer = createNavigationReducer(AppNavigator);
const appReducer = combineReducers({
nav: navReducer
});
// Note: createReactNavigationReduxMiddleware must be run before reduxifyNavigator
const middleware = createReactNavigationReduxMiddleware(
"root",
state => state.nav
);
export const App = reduxifyNavigator(AppNavigator, "root");
const store = createStore(appReducer, applyMiddleware(middleware));
export default class Root extends React.Component {
render() {
return (
<Provider store={store}>
<ReduxNavigation />
</Provider>
);
}
}