[SOLVED] Hide Bottom Tab Bar In Specific Screen

Issue

This Content is from Stack Overflow. Question asked by Muhammad Uzair

I am working on a project and need your help. I want to hide bottom tab bar in “auth” route name. I have tried several methods from stackoverflow and google but it didn’t work.
My Code:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow strict-local
 */

import React from 'react';
import {View} from 'react-native';
import Auth from './views/Auth';
import AuthState from './context/auth/AuthState';
import {NavigationContainer} from '@react-navigation/native';
import {createMaterialBottomTabNavigator} from '@react-navigation/material-bottom-tabs';
import Home from './views/Home';

const Tab = createMaterialBottomTabNavigator();

const App = () => {
  return (
    <AuthState>
      <NavigationContainer>
        <Tab.Navigator initialRouteName="auth">
          <Tab.Screen name="auth" component={Auth} />
          <Tab.Screen name="home" component={Home} />
        </Tab.Navigator>
      </NavigationContainer>
    </AuthState>
  );
};

export default App;



Solution

Well a better solution can be to create layout components

  • authorized and unauthorized layout component
  • you will have wrapper ready to use for future updates on these screens


This Question was asked in StackOverflow by Muhammad Uzair and Answered by Zhivko Nikolov It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?