How to hide toolbar in react navigation
To hide header for only one screen do this in createStackNavigator
function:
const Navigation= createStackNavigator({
Splash: {
screen:SplashScreen,
navigationOptions: {
header:null // this will do your task
}
},
Dashboard:{screen:Dashboard}
}
);
To hide header(toolbar) for all screen of createStackNavigator add
{
headerMode:'none'
}
inside createStackNavigator
. like this:
const Navigation= createStackNavigator({
Splash: {
screen:SplashScreen
},
Dashboard:{screen:Dashboard}
}
,{
headerMode:'none'
}
);
Note : I am using createStackNavigator
which may be StackNavigator
for others. So if you are using StackNavigator
do all this changes as i did in createStackNavigator
static navigationOptions = {
header: null ,
};
this works for me
class SplashScreen extends Component {
static navigationOptions = {
header: null ,
};
render() {
console.disableYellowBox = true;
const { navigate } = this.props.navigation;
return (
...
);
}
}