I want to hide header because I already have styled Toolbar in code:
import {createStackNavigator} from 'react-navigation' const AppStackNavigator = createStackNavigator ({ Home: HomePage, Friend: AddFriend, Bill: AddBill, }) class App extends Component { render() { return ( <AppStackNavigator initialRouteName='Home'/>`<br> ); } } export default App;
What should I add to my code?
To disable headers for all views in a createStackNavigator , you can use headerMode option. Show activity on this post. Show activity on this post.
In react navigation 5. x you can hide the header for all screens by setting the headerMode prop of the Navigator to false .
To hide the navigation navbar with React Native, we set the screenOptions. headerShown option to false . <Stack.
update your code like this code
const AppStackNavigator = createStackNavigator ({ Home: { screen: HomePage, navigationOptions: { header: null, }, }, })
and if you dont want the header for all screens, then
const AppStackNavigator = createStackNavigator ({ Home: { screen: HomePage, }, }, { navigationOptions: { header: null, }, })
Note: This solution is for an old version of React Navigation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With