【问题标题】:How to show Bottom tab navigation in specific screens only如何仅在特定屏幕中显示底部标签导航
【发布时间】:2021-03-11 13:07:23
【问题描述】:

我有反应本机应用程序,我正在使用反应导航,我的导航堆栈如下所示:

<AppStack.Navigator screenOptions={{
      headerStyle: {
        backgroundColor: COLORS.primary2,
        elevation: 0, 
        shadowOpacity: 0,
      },
      headerTintColor: '#fff',

    }}>
      <AppStack.Screen
        name="Home"
        component={HomeScreen}
        options={{
          headerShown: false
        }}
      />
      <AppStack.Screen
        name="qr"
        component={qr}
        options={{
          headerShown: false
        }} />
      <AppStack.Screen
        name="Profile"
        component={ProfileScreen}
        options={{ headerShown: false }}
      />
      <AppStack.Screen
        name="Notifications"
        component={NotificationScreen}
        options={{ headerShown: false }}
      />
      <AppStack.Screen
        name="Support"
        component={ChatScreen}
        options={{ headerShown: false }}
      />

</AppStack.Navigator>

我想创建createBottomTabNavigator,但要显示在 AppStack 的所有屏幕中,除了以下主屏幕

<AppStack.Screen
            name="Home"
            component={HomeScreen}
            options={{
              headerShown: false
            }}
    />

我想知道实现它的最佳做法是什么。

【问题讨论】:

    标签: javascript react-native react-native-navigation


    【解决方案1】:

    您可以为此目的使用tabBarVisible(boolean) prop。

    <AppStack.Screen
                name="Home"
                component={HomeScreen}
                options={{
                  headerShown: false
                }}
                navigationOptions:()=>{
                   return {
                     tabBarVisible:false,
                  }
                }
        />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-02
      • 2021-01-10
      • 1970-01-01
      • 1970-01-01
      • 2019-06-22
      相关资源
      最近更新 更多