如何避免其他选项卡中的数据在当前选项卡中可见
How to avoid data from other tab to be visible in current tab
我正在使用 createMaterialTopTabNavigator 在 React Native 中显示 Top Tabs 但来自其他选项卡的数据在当前选项卡上可见
我尝试将容器样式设置为 flex 1
和 flexWrap : 'wrap'
但问题仍然存在
const NotificationTabs = createMaterialTopTabNavigator(
{
MobileNotification: {
screen: MobileNotificationScreen,
navigationOptions: {
title: Languages.Notifications.Mobile,
},
},
EmailNotification: {
screen: EmailNotificationScreen,
navigationOptions: {
title: Languages.Notifications.Email,
},
},
},
{
initialRouteName: 'MobileNotification',
tabBarComponent: TopTabBarComponent,
tabBarOptions: {
style: {
backgroundColor: Colors.SAWhite,
},
labelStyle: {
color: Colors.SAPrimary,
...Fonts.Style.normal,
},
activeTintColor: Colors.SAPrimary,
inactiveTintColor: Colors.SASecondary,
upperCaseLabel: false,
},
}
);
<View style={styles.flat}>
<NotificationTabs navigation={navigation} />
</View>
样式
flat: {
flex:1
borderRadius:10
marginTop: '10%',
padding: 4,
backgroundColor: Colors.SAWhite,
},
我通过将 overflow: 'hidden'
添加到样式
来修复它
flat: {
flex:1
borderRadius:10
marginTop: '10%',
padding: 4,
backgroundColor: Colors.SAWhite,
overflow: 'hidden'
}
我正在使用 createMaterialTopTabNavigator 在 React Native 中显示 Top Tabs 但来自其他选项卡的数据在当前选项卡上可见
我尝试将容器样式设置为 flex 1
和 flexWrap : 'wrap'
但问题仍然存在
const NotificationTabs = createMaterialTopTabNavigator(
{
MobileNotification: {
screen: MobileNotificationScreen,
navigationOptions: {
title: Languages.Notifications.Mobile,
},
},
EmailNotification: {
screen: EmailNotificationScreen,
navigationOptions: {
title: Languages.Notifications.Email,
},
},
},
{
initialRouteName: 'MobileNotification',
tabBarComponent: TopTabBarComponent,
tabBarOptions: {
style: {
backgroundColor: Colors.SAWhite,
},
labelStyle: {
color: Colors.SAPrimary,
...Fonts.Style.normal,
},
activeTintColor: Colors.SAPrimary,
inactiveTintColor: Colors.SASecondary,
upperCaseLabel: false,
},
}
);
<View style={styles.flat}>
<NotificationTabs navigation={navigation} />
</View>
样式
flat: {
flex:1
borderRadius:10
marginTop: '10%',
padding: 4,
backgroundColor: Colors.SAWhite,
},
我通过将 overflow: 'hidden'
添加到样式
flat: {
flex:1
borderRadius:10
marginTop: '10%',
padding: 4,
backgroundColor: Colors.SAWhite,
overflow: 'hidden'
}