-1

I use a bottom tabs navigator imported from 'react-navigation-tabs'

import { createBottomTabNavigator } from 'react-navigation-tabs';

const AppNavigator = createBottomTabNavigator({
  Homepage: {
    screen: Screen1
  },
  Screen2: {
    screen: Screen2
  }
} , {
  initialRouteName:"Screen1"
});

Screen 1 is a stack navigator

const AppNavigator = createStackNavigator({
    Homepage: {
      screen: Screen1,
    },
    Screen2: {
        screen: Screen2
    }
} , {
    initialRouteName : "Homepage",
    headerMode:"none",
    navigationOptions: ({ navigation }) => ({
        tabBarVisible: navigation.state.routes[navigation.state.index].routeName === 'Screen2' ? false : true
    })
});

After some researches , I found the below solution , but not works

navigationOptions: ({ navigation }) => ({
        tabBarVisible: navigation.state.routes[navigation.state.index].routeName === 'Screen2' ? false : true
    })

It's a bad news because even to hide it from all screens , the below code also did not work

navigationOptions: ({ navigation }) => ({
        tabBarVisible: false
    })

the tabs always visible , after much researches and trying tens of solutions

  • Possible duplicate of [React Navigation how to hide tabbar from inside stack navigation](https://stackoverflow.com/questions/51352081/react-navigation-how-to-hide-tabbar-from-inside-stack-navigation) – Gaurav Roy Nov 28 '19 at 11:59

1 Answers1

0

Try this:

Screen1.navigationOptions = ({ navigation }) => {

    let tabBarVisible = true;

    let routeName = navigation.state.routes[navigation.state.index].routeName

    if ( routeName == 'ScreenX' ) {
        tabBarVisible = false
    }

    return {
        tabBarVisible,
    }
}
Awab Ijaz
  • 101
  • 5