我需要刷新相同的屏幕使用导航抽屉反应native.I可以刷导屏幕导航其他屏幕。但我点击相同的屏幕链接我无法得到任何响应。我怎么做
你可以通过以下方式做到
在导航中添加一个参数(isFromHome),
const navigateAction = NavigationActions.navigate({
routeName: routeName,
params: { isFromHome: true}
});
this.props.navigation.dispatch(navigateAction);
然后在你班级的componentWillReceiveProps()
中添加代码
例如:
componentWillReceiveProps(newProps) {
console.log("#######", newProps.navigation.state.params.isFromHome);
// Here you will get the parameter every time. By checking the parameter you can achieve your need.
}