I would like to be able to hide the tabs on a screen using React Native Navigation v5.
I\'ve been reading the documentation but it doesn\'t seem like they\'ve update
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; // version 5.6.1
import { createStackNavigator } from "@react-navigation/stack"; // version 5.6.2
From my inspection navigation.routes.state.index will have a value when you navigation/push to a second screen so I create a function
const shouldTabBarVisible = (navigation) => {
try {
return navigation.route.state.index < 1;
} catch (e) {
return true;
}
};
and call it in BottomTab.Screen options
({
tabBarIcon: ({ color }) => ,
tabBarVisible: shouldTabBarVisible(navigation),
})}
/>