ReactNative开发之react-navigation不集
2017-12-02 本文已影响0人
漂泊_sbb
在不集成redux的情况下
EditCover.js
render() {
const { state, navigate } = this.props.navigation;
return (
<View>
<Button title="Go to Page" onPress={ () => {
/* pass key down to *EditPage* */
navigate('EditPage', { go_back_key: state.key });
}} />
</View>
);
}
EditPage.js
render() {
const { state, goBack } = this.props.navigation;
const params = state.params || {};
return (
<View>
<Button title="Back to Cover" onPress={ () => {
/* go back from *EditCover* to *Cover* */
goBack(params.go_back_key);
}} />
</View>
);
}
参考资料