react-native - 一个屏幕上的多个堆栈导航器
问题描述
您如何使用 React Navigation 5在一个Drawer.Screen上显示多个Stack.Navigators 。
假设我有两种类型的产品:我的 Dashboard Drawer.Screen上的手机和平板电脑。手机和平板电脑代表一个单独的Stack.Navigators,我如何在同一个屏幕上显示它们?
解决方案
你可以这样做:
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>
);
};
推荐阅读
- javascript - 如何修复 Puppeteer 中的“没有这样的文件或目录”错误
- tomcat - 无法访问tomcat
- java - 春季如何打造一池豆豆?
- android - 如果在 exoplayer android 中屏幕关闭,我想播放视频,如何?
- python-3.x - 通过 .trace() 调用函数时收到“NoneType Object is not Callable”错误
- python - 如何根据数据集中的条件将值从字典复制到列表中?
- swagger - 如何将对象列表和不同对象作为 API 的响应
- java - 通过 Projection 根据他们的属性获取孩子的数量
- react-native - FlatList Navigate to New Screen on press item React Native
- c# - 我需要帮助在带有 id 和文本的文本框中自动完成