aksonov / aksonov/react-native-router-flux
onExit "this" context
- 主要语言
- JavaScript
- 星标
- 8.9k
- 派生
- 2.1k
- PR 合并指标
- 30 天内没有已合并 PR
描述
### Version
Tell us which versions you are using:
- react-native-router-flux: ^4.0.5
- react: 16.5.0
- react-native: 0.57.2
- react-redux: ^6.0.0
Hi, Any one can show me how it works onExit(), i am doing this:
- Router:
`
X.onExit()}
/>
`
- Component (using connect(), react-redux)
`
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as actionCreators from '../Actions/XActions';
class ServicesScreen extends Component {
static onExit() {
this.props.actions.cleanState();
}
render() {
return ...
}
}
const mapStateToProps = ({ state }) => {
const {
x,
} = state;
return {
x
};
};
const mapDispatchToProps = (dispatch) => {
return { actions: bindActionCreators(actionCreators, dispatch) };
};
export default connect(mapStateToProps, mapDispatchToProps)(ServicesScreen);
`
if i console log `Actions.refs.x.props.actions` on onExit() i get `undefined`.
I need to reset my state Component.
贡献指南
评估
这个 Issue 还没有评估数据。