Is it possible to show tab bar in a screen but the screen does not appear in the tab bar?

Viewed 653

Let I have three screens.

  1. Home
  2. Profile
  3. Settings

When the App starts, Home screen will show with two tab (Profile and Settings). I have used react-navigation for tab navigator. When Profile tab will be clicked, profile screen will show and if Settings tab will be clicked, Settings screen will show.

1 Answers

You can add a Navigation Object to another as screen. I tried to create a sample code according to your needs

const HomeScreen = createTabNavigator({
  HomeScreen: { 
    screen: HomeScreen,
    navigationOptions: {
        header: null,
        tabBarLabel: 'Profile',
        tabBarOnPress: ({ navigation }) => {
               navigation.navigate('Profile')  
        }
    }
  },
  Settings: { 
    screen: Settings,
    navigationOptions: {
        header: null
    }
  },



},

{
    initialRouteName: 'HomeScreen',
    lazy: true,
})
const HomeScreen = createStackNavigator({
  Profile: { 
    screen: Profile,
    navigationOptions: {
        header: null
    }
  },
  Home: { 
    screen: Home,
    navigationOptions: {
        header: null
    }
  },



},

{
    initialRouteName: 'Home',
    lazy: true,


})
Related