我在我的反应原生项目中使用标签。我想更新标题文本并显示/隐藏选项卡上的左、右按钮单击反应原生。
我将此代码用于选项卡导航和 StackNavigator 用于选项卡屏幕:
const TabScreen = createMaterialTopTabNavigator(
{
AllChallenges: {
screen: AllChallenges,
navigationOptions: {
title: 'All CHALLENGES',
fontFamily: Fonts.medium,
header: null,
}
},
YourProgress: {
screen: YourProgress,
navigationOptions: {
title: 'YOUR PROGRESS',
fontFamily: Fonts.medium,
header: null,
}
},
},
{
tabBarPosition: 'top',
header: null,
swipeEnabled: false,
animationEnabled: true,
tabBarOptions: {
activeTintColor: 'rgb(94,94,95)',
inactiveTintColor: 'rgb(221,221,221)',
style: {
backgroundColor: '#ffffff',
height: 40,
},
labelStyle: {
marginTop: 5,
textAlign: 'center',
fontFamily: Fonts.medium,
fontSize: 12,
},
indicatorStyle: {
borderBottomColor: 'rgb(32,186,113)',
borderBottomWidth: 2,
},
},
}
);
//making a StackNavigator to export as default
const Challenges = createStackNavigator({
TabScreen: {
screen: TabScreen,
header: null,
navigationOptions: ({ navigation }) => {
// ListAisle.headerList()
return {
title: "CHALLENGES",
headerTintColor: 'white',
headerTitleStyle: {
textAlign: 'center',
flexGrow: 2,
alignSelf: 'center',
marginLeft: 12,
fontFamily: Fonts.summerNormal,
fontSize: 25,
},
headerStyle: {
backgroundColor: '#ff6500'
},
tabBarOnPress: () => Alert.alert('hello')
}
},
},
});
在下面点击复选框按钮的屏幕截图中,我想在标题中显示删除按钮
知道如何更新标题并显示隐藏标题按钮吗?