【发布时间】:2017-06-27 09:31:00
【问题描述】:
我使用react-navigation 进行路由。我想在一个组件上动态隐藏或显示标题。有什么办法吗?
我像这样动态更改 headerLeft,但找不到任何方法来为整个标题执行此操作。
static navigationOptions = ({ navigation }) => ({
headerRight: navigation.state.params ? navigation.state.params.headerRight : null
});
this.props.navigation.setParams({
headerRight: (
<View>
<TouchableOpacity onPress={() => blaa} >
<Text>Start</Text>
</TouchableOpacity>
</View>
)
});
我想要这样的东西 - 根据状态隐藏/显示标题:
this.props.navigation.setParams({
header: this.state.header
});
【问题讨论】:
标签: react-native react-navigation