简体   繁体   English

反应本机无法使用反应导航隐藏底部栏中的选项卡

[英]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.

相关问题 使用时如何从底部标签栏隐藏“SPECIFIC TAB BAR ITEM”:@react-navigation/bottom-tabs - How to hide a "SPECIFIC TAB BAR ITEM" from a bottom tab bar when using: @react-navigation/bottom-tabs 如何隐藏特定屏幕上的底部标签栏(react-navigation 3.x) - How can I hide the bottom tab bar on a specific screen (react-navigation 3.x) 如何在 React-Navigation 底部标签栏下方显示内容? - How to show content below bottom tab bar in React-Navigation? 如何使用 react-navigation 在 React Native 中创建自定义顶部标签栏? - How to create Custom Top tab bar in React Native using react-navigation? 如何使用react-navigation在react-native中添加搜索栏和选项卡按钮 - How to add both search bar and tab buttons in react-native using react-navigation 反应本机底部标签栏导航 - React native bottom tab bar navigation 无法从反应导航工作中获取标签栏 - Unable to get tab bar from react-navigation working 使用 React-Navigation 底部选项卡的交叉淡入淡出过渡 - Cross-Fade transitions using React-Navigation bottom Tab React Native:无法使用react-navigation传递参数 - React Native: Unable to pass params using react-navigation 如何在不重新加载导航的情况下使用 react-navigation 更新 React-Native 中的标签栏徽章? - How do I update the tab bar badge in React-Native using react-navigation without the navigation being reloaded?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM