-
Notifications
You must be signed in to change notification settings - Fork 3
/
AppRedux1.js
46 lines (35 loc) · 1.12 KB
/
AppRedux1.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
import React, { Component } from 'react'
// import { NativeAppEventEmitter, DeviceEventEmitter } from 'react-native'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import * as actionCreators from './src/redux/actions'
// import RnToast from './src/module/RnToast'
import Page1 from './src/views/page1'
class ReduxRoute extends Component {
constructor(props) {
super(props)
}
componentWillMount() {
// 注册绑定事件,IOS目前还未兼容好
// const emitter = Platform.OS === 'ios' ? NativeAppEventEmitter : DeviceEventEmitter
// emitter.addListener('keyboardWillShow', data => {
// this.props.setUserInfo({ routerType: data.key })
// RnToast.show('event listener success' + data.key, RnToast.LONG)
// })
}
componentDidMount() {
}
render() {
return <Page1 />
}
}
// 关联 redux store
function mapStateToProps(state) {
return {
userInfo: state.reducers.userInfo
}
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(actionCreators, dispatch)
}
export default connect(mapStateToProps, mapDispatchToProps)(ReduxRoute)