我对docs和stackoverflow做了一些研究,找不到任何相关的帖子/文档。
我使用TabNavigator和StackNavigator进行应用程序导航,我想在切换标签时更改navigationOption标头组件。我有3个标签Home
,Live
和Radio
示例 - 当标签是Home标题组件时
<View><ScrollView><GenerateList_1/></ScrollView></View>
当标签是Live标头组件
时 <View><ScrollView><GenerateList_2/></ScrollView></View>
const mainNav = TabNavigator({
Home: { screen: HomeScreen},
Live: { screen: LiveScreen },
Radio: { screen: RadioScreen},
} );
export const mainStack = StackNavigator({
Home: {
screen: mainNav,
navigationOptions: {
header: (
<View style={styles.topnavscrollview}>
<View style={{width:300}}>
<ScrollView horizontal={true} showsHorizontalScrollIndicator={false}>
<GenerateList_1/> <-- Change this when switch to Live tab or others
</ScrollView>
</View>
</View>
),
},
},
Content: { screen: ContentScreen },
});
当前标题在每个标签上共享