首页 文章

在DrawerNavigator屏幕中显示TabBar

提问于
浏览
1

我目前有这种结构:

const Tabs = TabNavigator({
  Home: {screen: Home},
  Store:{screen: Store}
  More: {screen: More,
    navigationOptions: {
      tabBarLabel: 'More',
      tabBarIcon: <Entypo name='dots-three-horizontal' size={25}/>,
      header: null
      },
    }
  },
  {
  initialRouteName: 'Home',
  tabBarPosition: 'bottom',
  navigationOptions: ({ navigation }) => ({
            tabBarOnPress: (scene, jumpToIndex) => {
                if (scene.route.routeName === "More") {
                  navigation.navigate('DrawerToggle')
                }
                else{
                  jumpToIndex(scene.index);
                }
            },
        }),
      },
    )


const Drawer = DrawerNavigator(
  {
   Tabs: {screen: Tabs,
     navigationOptions: {
           drawerLabel: () => null
      }
   },
   Profile: {screen: Profile},
   Search: {screen: Search}
  },
  {
   initialRouteName: 'Tabs',
   headerMode: 'none',
   drawerPosition: 'right'
  }
)


export const Root = StackNavigator(
  {
  LoginScreen: {screen: Login},
  Drawer: {screen: Drawer},
 },
  {
   initialRouteName: 'LoginScreen'
  }
)

一切都很好 . 单击(例如)“配置文件”时,页面正常加载,单击“更多”时,将打开抽屉菜单 .

我想要实现的功能是我想在'Profile'页面(DrawerNavigator屏幕)中显示TabBar . 怎么可能?

1 回答

  • 0
    const Drawer = DrawerNavigator(
      {
       Profile: {screen: Tabs},
       Search: {screen: Search}
      }
    

    您可以将导航器嵌套在另一个导航器中 . 选项卡导航器是一个组件,您可以将该组件用作不同导航器的“屏幕” .

    导航器是一个组件 . 屏幕必须是一个组件 .

相关问题