[英]react Native unable to hide a tab in the bottom bar using react-navigation
So I tried everything, however I am unable to make this tab disappear removing it所以我尝试了一切,但是我无法让这个标签消失删除它
I tried:我试过:
tabBarOptions: {
visible: false
}
but without any success.但没有任何成功。
Menu: {
screen: OtherStack,
tabBarOptions: {
visible: false
},
navigationOptions: ({navigation}) => ({
tabBarOnPress: () => {
navigation.toggleMenuDrawer()
},
}),
},
please explain the details and react-navigation version that you used.请解释您使用的详细信息和 react-navigation 版本。
if you use latest react-navigation which is version 5.x, then if you wanna hide specific bottom tab in specific screen, you can try this below code, basically, you just pass tabBarVisible: false,
.如果您使用最新的 react-navigation 版本 5.x,那么如果您想在特定屏幕中隐藏特定的底部选项卡,您可以尝试以下代码,基本上,您只需传递
tabBarVisible: false,
。
import React from 'react'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'
const Tab = createBottomTabNavigator()
export function tabNav() {
return (
<Tab.Navigator
backBehavior="initialRoute">
<Tab.Screen
name="tabChat"
component={ChatComponentExample}
options={{
tabBarVisible: false,
tabBarLabel: 'Message'
}}
/>
<Tab.Screen
name="anotherTab"
component={AnotherTabComponentExample}
options={{
tabBarLabel: 'AnotherTab'
}}
/>
</Tab.Navigator>
)
}
more: https://reactnavigation.org/docs/hiding-tabbar-in-screens/更多: https : //reactnavigation.org/docs/hiding-tabbar-in-screens/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.