react-native - react-navigation 5.0 - 屏幕两侧的抽屉
问题描述
我正在尝试从屏幕的每一侧获取抽屉。
但是我无法打开右边的那个。
我尝试使用 openDrawer () 方法以及 dangerouslyGetParent () 方法。OpenDrawer () 但没有任何效果。
这是我写的代码:
const UserDrawer = createDrawerNavigator()
const UserMenu = () => (
<UserDrawer.Navigator
drawerType="slide"
overlayColor="rgba(49, 70, 111, 0.75)"
drawerPosition="right"
>
<UserDrawer.Screen name="Profile" component={Profile}/>
<UserDrawer.Screen name="Company" component={Company}/>
</UserDrawer.Navigator>
)
const DashboardDrawer = createDrawerNavigator()
const DashboardMenu = () => (
<DashboardDrawer.Navigator
drawerType="slide"
overlayColor="rgba(49, 70, 111, 0.75)"
drawerPosition="left"
initialRouteName="Dashboard"
>
<DashboardDrawer.Screen name="Dashboard" component={Dashboard}/>
<DashboardDrawer.Screen name="Enterprise" component={Enterprise}/>
<DashboardDrawer.Screen name="Cases" component={Cases}/>
<DashboardDrawer.Screen name="Customers" component={Customers}/>
<DashboardDrawer.Screen name="Unpaid" component={Unpaid}/>
<DashboardDrawer.Screen name="Payments" component={Payments}/>
<DashboardDrawer.Screen name="Recommendations" component={Recommendations}/>
<DashboardDrawer.Screen name="UserNavigation" component={UserNavigation}/>
</DashboardDrawer.Navigator>
)
const AppStack = createStackNavigator()
const AppNavigation = () => (
<AppStack.Navigator headerMode="none">
<AppStack.Screen name="Home" component={HomeNavigation} />
<AppStack.Screen name="Dashboard" component={DashboardNavigation} />
</AppStack.Navigator>
)
const AppNavigationContainer = () => (
<NavigationContainer>
<AppNavigation />
</NavigationContainer>
)
谢谢你的帮助。
解决方案
推荐阅读
- javascript - 为什么 HTML div 元素在移动设备上旋转奇怪?
- string - 如何在Powershell中用&而不是&替换字符串
- sql-server - SQL 查询 - 给定两个日期,重复一个表的记录
- bash - awk:搜索一个字符串,但只在一个范围内
- .net - 无法恢复测试项目 Nuget 包 Spring.NET 3.0 GA
- flutter - 如何从手机中检索联系人的详细信息并使用颤振将其保存在应用程序中
- java - 找不到 OpenLiberty mpRestClient 教程功能定义
- python - Python 中的析构函数
- bash - bash 脚本,在变量中使用变量
- javascript - 成功提交表单后,如何从 firestore 中减少字段值?