Parameters 在react导航5中的goBack上设置参数
我的应用程序中有一个自定义返回按钮,我想返回到上一个屏幕,并传递参数,但它不起作用。它可以返回,但参数似乎未定义Parameters 在react导航5中的goBack上设置参数,parameters,react-hooks,react-navigation-v5,Parameters,React Hooks,React Navigation V5,我的应用程序中有一个自定义返回按钮,我想返回到上一个屏幕,并传递参数,但它不起作用。它可以返回,但参数似乎未定义 <TouchableOpacity onPress={() => navigation.dispatch( CommonActions.goBack(), CommonActions.setParams({params: 1}) ) } style={{ padd
<TouchableOpacity
onPress={() =>
navigation.dispatch(
CommonActions.goBack(),
CommonActions.setParams({params: 1})
)
}
style={{ paddingRight: 15 }}>
<MaterialIcons name="arrow-back" color={Color.white} size={24} />
</TouchableOpacity>
这是我从控制台日志路由得到的结果
{
key: "UsersScreen-rX4fHw2Hy8sgmYgy9b97C"
name: "UsersScreen"
params: undefined
}
{
key: "UsersScreen-rX4fHw2Hy8sgmYgy9b97C"
name: "UsersScreen"
params: undefined
}