forked from dharavp/TextInput-React-Native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
54 lines (47 loc) · 1.28 KB
/
index.js
File metadata and controls
54 lines (47 loc) · 1.28 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
import { AppRegistry } from 'react-native';
import React from 'react';
import { addNavigationHelpers } from 'react-navigation';
import { Provider, connect } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import {
createReduxBoundAddListener,
createReactNavigationReduxMiddleware,
} from 'react-navigation-redux-helpers';
import ReduxThunk from 'redux-thunk';
import appReducer from './src/reducer';
import AppRouteConfig from './src/AppRouteConfig';
const middleware = createReactNavigationReduxMiddleware(
'root',
state => state.nav,
);
const addListener = createReduxBoundAddListener('root');
class AppEx extends React.Component {
render() {
return (
<AppRouteConfig
navigation={addNavigationHelpers({
dispatch: this.props.dispatch,
state: this.props.nav,
addListener,
})} />
);
}
}
const mapStateToProps = (state) => ({
nav: state.nav
});
const AppWithNavigationState = connect(mapStateToProps)(AppEx);
const store = createStore(
appReducer,
applyMiddleware(middleware),
);
class Root extends React.Component {
render() {
return (
<Provider store={store}>
<AppWithNavigationState />
</Provider>
);
}
}
AppRegistry.registerComponent('EditTextWithNavigation', () => Root);