React导航导航选项访问道具

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

如何在React导航导航选项中实现条件?

 static navigationOptions = {
   headerTitle: this.props.moneyContext === 'Send' ? 'Send money' : 'Receive money',
 };

moneyContext取决于打开的屏幕并从商店获取数据。

谢谢!

react-native react-navigation
1个回答
1
投票

您可以尝试使用setParams:

navigation.setParams({ param: value })

有关更多详细信息,请参阅documentation on headers

© www.soinside.com 2019 - 2024. All rights reserved.