【问题标题】:Multiple Stack Navigators on one screen一个屏幕上的多个堆栈导航器
【发布时间】:2020-07-22 23:06:06
【问题描述】:
如何使用 React Navigation 5 在一个 Drawer.Screen 上显示多个 Stack.Navigators。
假设我有两种类型的产品:我的仪表板上的手机和平板电脑Drawer.Screen。手机和平板代表一个单独的Stack.Navigators,我如何在同一个屏幕上显示它们?
【问题讨论】:
标签:
react-native
react-redux
react-navigation
react-navigation-stack
react-navigation-v5
【解决方案1】:
你可以这样做:
export const DrawerNavigator = props => {
return (
<Drawer.Navigator
drawerContent={props => <DrawerScreen {...props} />}
initialRouteName={'HomeScreen'}
drawerPosition={'right'}
drawerStyle={{width: '100%', backgroundColor: 'transparent'}}
screenOption={{backBehavior: 'order'}}>
<Drawer.Screen
name="App"
component={isMobile ? MobileStackNavigator : tabletStackNavigator}
options={{gestureEnabled: false}}
/>
</Drawer.Navigator>
);
};