-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
76 lines (71 loc) · 1.92 KB
/
App.js
File metadata and controls
76 lines (71 loc) · 1.92 KB
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
66
67
68
69
70
71
72
73
74
75
76
import React from 'react';
import { createStackNavigator } from 'react-navigation';
import WelcomeComponent from './components/WelcomeComponent';
import LoginViewComponent from './components/LoginViewComponent';
import {
createNavigationReducer,
createReactNavigationReduxMiddleware,
createReduxContainer,
} from 'react-navigation-redux-helpers';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { Provider, connect } from 'react-redux';
import userReducer from './reducers/userReducer';
import SignupViewComponent from './components/SignupViewComponent';
import LeagueGameListComponent from './components/LeagueGameListComponent';
import LeagueListComponent from './components/LeagueListComponent';
const AppNavigator = createStackNavigator({
Welcome: {
screen: WelcomeComponent,
navigationOptions: {
header: null,
},
},
LoginView: {
screen: LoginViewComponent,
navigationOptions: {
header: null,
},
},
SignupView: {
screen: SignupViewComponent,
navigationOptions: {
header: null,
},
},
LeagueList: {
screen: LeagueListComponent,
navigationOptions: {
header: null,
},
},
LeagueGameList: {
screen: LeagueGameListComponent,
navigationOptions: {
header: null,
},
},
});
const navReducer = createNavigationReducer(AppNavigator);
const appReducer = combineReducers({
user: userReducer,
nav: navReducer,
});
const middleware = createReactNavigationReduxMiddleware(
state => state.nav,
'root'
);
const App = createReduxContainer(AppNavigator, 'root');
const mapStateToProps = state => ({
state: state.nav,
});
const AppWithNavigationState = connect(mapStateToProps)(App);
const store = createStore(appReducer, applyMiddleware(middleware));
export default class Root extends React.Component {
render() {
return (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
);
}
}