问题
I'm trying to show the Bottom TabBar in every screen in my app, but i can't find a way to do it in RN V5 yet,
So When i tried to use tabBarVisible
like this
<BottomTab.Navigator
lazy={false}
tabBar={props => <TabBar {...props} />}
screenOptions={({route}) => (
console.log('route', route), it's just log the five bottom component i have
{
tabBarVisible: ({routes}) => {
let tabBarVisible = false;
console.log('screens', routes); // Not log anything!
return {tabBarVisible};
},
}
)}
....
>
... 5 Tabs here
</BottomTab.Navigator>
So How can i handle this case? and access to other stack screens?
just to minimize the code snippet in question
here's the full Root file code, can you check it?
回答1:
If you want the tabBar
to be shown in every screen of the app, you need to make it your root navigator and then all screens will be under that navigator, so the tabBar
will be visible in all screens.
来源:https://stackoverflow.com/questions/60921909/how-can-i-force-tabbar-to-show-in-all-app-screens-react-navigation-v5