How to hide header of createStackNavigator on React Native?

后端 未结 8 1329
耶瑟儿~
耶瑟儿~ 2021-02-04 03:56

I want to hide header because I already have styled Toolbar in code:

import {createStackNavigator}
from \'react-navigation\'
const AppStackNavigator = createStac         


        
8条回答
  •  长情又很酷
    2021-02-04 04:22

    All the answers I could find were from React navigation v4 for some reason, which doesn't work in v5. After spending some time on it I figured out a way to hide toolbar in v5. Here it is:

    import { createStackNavigator } from "@react-navigation/stack";
    import { NavigationContainer } from "@react-navigation/native";
    
    ...
    
    const Stack = createStackNavigator();
    
    ....
    //and inside render
    render(){
        return (
              
                
                  
    }
    

    headerShown: false, this will do the trick

    If you need help with migrating from v4 to v5 -> https://reactnavigation.org/docs/upgrading-from-4.x/

提交回复
热议问题