我如何强制TabBar在所有App屏幕上显示react-navigation v5?

问题描述 投票:0回答:1

我正在尝试在我的应用程序的每个屏幕上显示底部TabBar,但是我还找不到在RN V5中实现此功能的方法,

所以当我尝试使用tabBarVisible这样的时候

<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>

所以我该如何处理这种情况?并访问其他堆栈屏幕?

只是为了最小化所讨论的代码片段

这是full Root file代码,您可以检查吗?

react-native react-navigation react-navigation-v5
1个回答
0
投票

[如果要在应用程序的每个屏幕中显示tabBar,则需要将其设置为您的根导航器,然后所有屏幕都将在该导航器下方,因此tabBar在所有屏幕中都可见。] >

© www.soinside.com 2019 - 2024. All rights reserved.