How can I force TabBar to show in all App screens react-navigation v5?

浪子不回头ぞ 提交于 2020-04-18 06:31:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!