【问题标题】:React Native: tabBarVisible option set to false but not hidding the the tabBarReact Native:tabBar Visible 选项设置为 false 但不隐藏 tabBar
【发布时间】:2021-09-03 10:01:00
【问题描述】:

我正在使用 React Navigation v5,但是当我将选项 tabBarVisible 设置为 false 时,tabBar 并没有隐藏。这是一段不起作用的代码。不知道怎么回事。

..

  <Tabs.Navigator screenOptions={screenOptions} initialRouteName="Home">
      <Tabs.Screen
        name="Home"
        component={Home}
        options={({ route }) => ({
          tabBarVisible: false, // <-- This not working
          tabBarIcon: (props) => (
            <TabIcon
              {...props}
              title="Home"
              Icon={{
                name: "home",
                IconComponent: AntDesign,
              }}
            />
          ),
        })}
      />
...

任何建议。

【问题讨论】:

  • screenOptions 中你可以将 prop headerShown 设置为 false 就像 screenOptions={{ headerShown: false }} 一样
  • 我对标题不感兴趣,我对标签栏感兴趣,但谢谢哥们。我也试过了,还是不行。

标签: reactjs react-native react-native-navigation


【解决方案1】:

这应该适用于最新版本的软件包:

  <Tab.Screen
    name="Settings"
    component={SettingsScreen}
    options={{ tabBarStyle: { display: 'none' } }}
  />

【讨论】:

  • 谢谢,当我使用您的建议时,当我返回主页选项卡时,我会丢失样式,但我要感谢您的回答。跨度>
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-02-26
  • 2015-11-21
  • 2011-02-03
  • 1970-01-01
  • 2011-12-09
  • 1970-01-01
  • 2023-01-31
相关资源
最近更新 更多