无法隐藏底部标签导航ReactNavigation

时间:2020-06-29 07:37:21

标签: react-native react-navigation

嗨,我有一个底部的标签栏导航,一个标签内有堆栈导航器,我想针对特定屏幕隐藏此导航

BottomTabBar:

onItemAtFrontLoaded

第一个问题是第2页和第3页应该没有选项卡栏(第1页有后退按钮)

第二个问题是,当我进入第2页或第3页的选项卡3,然后单击选项卡1,然后返回到选项卡3时,我仍然看到第2页或第3页,并且每次我将进入选项卡3

这是主要的底部标签栏导航器

false

我和这是设置(选项卡3),导航器:

onItemAtEndLoaded

我尝试了很多东西,但我无法隐藏该导航,而 --Tab 1 --Tab 2 --Tab 3: -- Page 1 (I want to have bottom bar here) -- Page 2 (I don't want to see bottom bar navigation) -- Page 3 (I don't want to see bottom bar navigation) --Tab 4 .... 也无法隐藏该导航。

1 个答案:

答案 0 :(得分:0)

您尝试过Hiding tab bar in specific screens吗?

在您的情况下,可能看起来像这样:

// TabNavigator.js
...
const { Navigator, Screen } = createBottomTabNavigator();

...


 return (
    <BackgroundSafeAreaView>
      <Navigator tabBar={(props) => <Navigation {...props} />}>

        <Screen
          component={SupportScreen}
          name="Support"
          options={{ title: 'Support', tabBarAccessibilityLabel: I18n.t('accessibility.navigation.supportTab') }}
        />
        <Screen
          component={Settings}
          name="Settings"
          options={{
            title: 'Settings',
            tabBarAccessibilityLabel: I18n.t('accessibility.navigation.settingsTab'),
            tabBarVisible: true,
          }}
        />
      </Navigator>
    </BackgroundSafeAreaView>
  );
};
const { Navigator, Screen } = createStackNavigator();

const SettingsNavigator = () => (
  <Navigator initialRouteName="Settings" screenOptions={{ headerShown: false }}>
    {/* Here use the Tavigator instead of Settings screen */}
    <Screen component={TabNavigator} name="Settings" />
    <Screen component={SignUpScreen} name="SignIn" />
    <Screen component={SetPasswordScreen} name="ChangePassword" />
  </Navigator>
);

export default SettingsNavigator;