Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove double header with react-navigation?

My React Native 0.61.5 uses react-navigation 5.1. Here is the root navigation code:

const BTab = createBottomTabNavigator();
const Stack = createStackNavigator();
export default function App() {

  //const Appscreen = () => (<AppScreen data={data}/>);

  return (
    <NavigationContainer>
      <Stack.Navigator InitialRouteName="Splash">
        <Stack.Screen name="Splash" component={SplashScreen}}/>
        <Stack.Screen name="App" component={AppScreen} } />
      </Stack.Navigator>

    </NavigationContainer>
  );
}

The component AppScreen return a stack like this:

return (
    <NavigationContainer independent={true}>
      <BTab.Navigator>
          <BTab.Screen name="Event" component={Eventstack} />
          <BTab.Screen name="Group" component={Groupstack} />
          <BTab.Screen name="Contact" component={Contactstack} />
      </BTab.Navigator>
    </NavigationContainer>
  );

I notice that on the screen there are double header:

enter image description here

How can I remove the App header and only keep the Group?

like image 824
user938363 Avatar asked Nov 16 '25 04:11

user938363


1 Answers

add with the screen that you want to hide the header.

options= {{
  headerShown: false
}}

For further reading, kindly have a look at https://reactnavigation.org/docs/stack-navigator/#headershown

like image 174
Anson Mathew Avatar answered Nov 17 '25 21:11

Anson Mathew



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!