-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
39 lines (31 loc) · 861 Bytes
/
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
// @flow
import React from 'react';
import { connect, Provider } from 'react-redux';
import { AppRegistry } from 'react-native';
import { addNavigationHelpers } from "react-navigation";
import configureStore from './src/store/configureStore';
import { AppNavigator } from './src/AppNavigator';
type State = {
nav: any, // TODO
};
type Props = {
dispatch: any, // TODO
nav: any, // TODO
};
const App = ({ dispatch, nav}: Props) => (
<AppNavigator navigation={addNavigationHelpers({
dispatch,
state: nav,
})} />
);
const mapStateToProps = (state): State => ({
nav: state.nav
});
const AppWithNavigationState = connect(mapStateToProps)(App);
const store = configureStore();
const ReduxApp = () => (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
);
AppRegistry.registerComponent('JamesGarage', () => ReduxApp);