Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide header of createStackNavigator on React Native?

Tags:

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?

like image 594
Just Ahead Avatar asked Jul 02 '18 05:07

Just Ahead


People also ask

How do I hide the header in createStackNavigator?

To disable headers for all views in a createStackNavigator , you can use headerMode option. Show activity on this post. Show activity on this post.

How do I hide the header in react native?

In react navigation 5. x you can hide the header for all screens by setting the headerMode prop of the Navigator to false .

How do I hide the top bar in stack navigation in react native?

To hide the navigation navbar with React Native, we set the screenOptions. headerShown option to false . <Stack.


1 Answers

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.

like image 64
Aravind S Avatar answered Oct 10 '22 11:10

Aravind S