React-native-navigation:goBack() 不起作用 [英] React-native-navigation: goBack() doesn't work
问题描述
我在 React Native 中使用 React Navigation 和 Redux.导航工作正常,但在一个屏幕上 goBack() 函数不起作用.你能告诉我们为什么吗?
I use React Navigation with Redux in React Native. Navigation is working fine, but on one screen the goBack() function doesn't work. Can you tell we why?
这是标题配置:
static navigationOptions = {
header: ({ state, goBack }) => {
return {
title: state.params.name,
right: (<Button
title={'Done'}
onPress={() => goBack()}
/>)
}
}
}
这是分派的事件:
没有弹出屏幕.设备上的屏幕保持不变.
推荐答案
尝试
当 null 用作输入参数时,它会将您带到最后一页(即时历史记录),并且在嵌套 StackNavigators 返回父级的情况下会有所帮助navigator 当子导航器在堆栈中只有一个项目时.
when null is used as input parameter it will bring you to the last page(immediate history) and it helps in situations where nested StackNavigators to go back on a parent navigator when the child navigator already has only one item in the stack.
他们将来可能会改变,因为根据他们的文档,他们计划改变它.
They may change in future because according to their documentation there are planning to change it.
欲了解更多信息,请查看 这里 .
For more information check here .
这篇关于React-native-navigation:goBack() 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!