我使用react-navigation并希望一起使用TabNavigator和DrawerNavigator . 我知道你可以嵌套导航器,但是只有抽屉的一个链接有我的选项卡 .
我希望标签导航始终可见,抽屉应该可用 .
因此,顶部的三个标签应始终可见 . 抽屉可以滑出来连接不同的场景 .
const CustomTabRouter = TabRouter({
Tab1: {
screen: Tab1,
path: '1',
},
Tab2: {
screen: Tab2,
path: '2',
},
Tab3: {
screen: Tab3,
path: '3',
},
}, {
initialRouteName: 'Tab2',
})
const TabNavigation = createNavigationContainer(
createNavigator(CustomTabRouter)(CustomTabView)
)
const AppNavigation = DrawerNavigator({
Home: {
screen: TabNavigation
},
ScreenOne: {
screen: ScreenOne
},
ScreenTwo: {
screen: ScreenTwo
},
}, {
headerMode: 'none',
initialRouteName: 'Home',
drawerPosition: 'right',
contentComponent: props => Slider(props),
contentOptions: {
inactiveTintColor: Colors.primary,
activeTintColor: Colors.orange,
activeBackgroundColor: Colors.white
},
})
但我的代码的问题是标签只适用于一个场景 . 还尝试了StackNavigators,但必须是另一个同时使用Navigators的解决方案 .