// Solution 1
**React Navigation 6**
In screen options: Set edge width to 0.
<Drawer.Navigator
screenOptions={{
swipeEdgeWidth: 0,
}}
>
{/* screens */}
</Drawer.Navigator>
**React Navigation 5**
In your createDrawerNavigator config:
const drawerNavigator = createDrawerNavigator({
Home: {
screen: Home
}
},
{
edgeWidth: 0
})
//Solution 2 : This may also work.
You can use the drawerLockMode in the screen navigation options using the option locked-open
locked-open: the drawer will stay opened and not respond to gestures. The drawer may still be opened and closed programmatically
Other options can be viewed here
static navigationOptions = {
drawerLockMode: 'locked-open',
}
2条答案
按热度按时间ff29svar1#
您需要在
screenOptions
中使用swipeEnabled
属性禁用滑动才能打开/关闭抽屉,例如:你需要在1个堆栈中定义一个抽屉项目,就像我的例子一样:https://snack.expo.dev/@pqv2210/q-74710170
dtcbnfnu2#