Search code examples
react-nativereact-navigationreact-native-navigation

Remove Header in React navigation v6


Remove Header in React navigation 6 with custom style here is code foe stack navigation

 <NavigationContainer>
  <Stack.Navigator
    initialRouteName='OtpScreen'
    // screenOptions={{
    //   headerShown: false,
    // }}
    screenOptions={{ headerMode: 'none' }}
  >
    <Stack.Screen
      options={{ headerShown: false }}
      name='Tabs'
      component={MyTabs}
    />

  </Stack.Navigator>
</NavigationContainer>

tab navigation

   <Tab.Navigator
  useHeaderHeight={false}
  screenOptions={
    ({
      headerShown: false,
    },
    ({ route }) => ({
      tabBarIcon: ({ focused, color, size }) => {
        let iconName;

        if (route.name === 'Home') {
          iconName = focused
            ? 'ios-information-circle'
            : 'ios-information-circle-outline';
        } else if (route.name === 'Settings') {
          iconName = focused ? 'ios-list' : 'ios-list';
        }

        // You can return any component that you like here!
        return <Ionicons name={iconName} size={size} color={color} />;
      },
      tabBarActiveTintColor: 'tomato',
      tabBarInactiveTintColor: 'gray',
    }))
  }
>

I use every possible solution still not get the answer I want to use it with custom style as I shown


Solution

  • Add like this

     <Stack.Navigator
        initialRouteName='OtpScreen'
        screenOptions={{
          headerShown: false,
        }}
        screenOptions={{ headerMode: 'none' }}
      ></Stack.Navigator>
    

    headerShown: false, this will do work