0

I am new to react native.

I am trying to create two screens. My issue is that I don't want app bar on the first screen but I want app bar on the second screen as I need to go back.

am going to the next screen by pressing the card from the first screen and am using createStackNavigator for navigation.

import React, { Component } from 'react';
import { createStackNavigator } from 'react-navigation';
import HomeScreen from './components/homeScreen';
const RootStack = createStackNavigator(
    {
      Home: HomeScreen,
    //   Details: DetailsScreen,
    },
    {
      initialRouteName: 'Home',
    },
    { headerMode: 'none' },
  );


export default class App extends Component {
  render() {
    return ( 
      <RootStack/>
    );
  }
}
Samuel Hulla
  • 6,617
  • 7
  • 36
  • 70
Andrew
  • 727
  • 1
  • 9
  • 12
  • 1
    check https://stackoverflow.com/questions/46065819/remove-top-navigation-bar-for-certain-screens – kj007 Sep 22 '18 at 17:36

2 Answers2

4

People coming here from using @react-navigation with React Native or Expo (Tab navigation in this case):

    <NavigationContainer>
      <Tab.Navigator
        screenOptions={{ headerShown: false }}

If you want to conditionally apply it just hook "headerShown" to a state variable.

Nine Magics
  • 637
  • 2
  • 8
  • 17
0

Simply do this and it will remove the appbar

class YourClass extends React.PureComponent {

static navigationOptions = {
    header: null,
  }
Haider Ali
  • 1,275
  • 7
  • 20