当prop在React Native Navigation中更改其值时如何更新初始参数

问题描述 投票:0回答:1

我有一个道具,当我更新状态时会改变。将数据传递到屏幕时,如何更新初始参数?

props.authMsg得到更新,但没有更新[[初始参数

<Stack.Screen initialParams={{authMsg: props.authMsg}} name="Login" component={Login} />
参数值保持不变。

<Text>{props.route.params.authMsg}</Text>

react-native react-native-navigation
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.