Reactjs 将手势/滑动设置为false不起作用[react navigation v5]
在react本机应用程序中,我希望在某些屏幕上禁用抽屉。所有屏幕都堆叠并传递到Reactjs 将手势/滑动设置为false不起作用[react navigation v5],reactjs,react-native,react-navigation,react-navigation-stack,react-navigation-drawer,Reactjs,React Native,React Navigation,React Navigation Stack,React Navigation Drawer,在react本机应用程序中,我希望在某些屏幕上禁用抽屉。所有屏幕都堆叠并传递到drawerNavigation。当gestureabled或swipenabled至false时,仍然通过滑动抽屉打开 const StackScreens = ({navigation}) => ( <Stack.Navigator initialRouteName="SplashScreenCtrl" headerMode="screen"
drawerNavigation
。当gestureabled
或swipenabled
至false
时,仍然通过滑动抽屉打开
const StackScreens = ({navigation}) => (
<Stack.Navigator
initialRouteName="SplashScreenCtrl"
headerMode="screen"
screenOptions={{}}
mode="card">
<Stack.Screen name="Splash" component={SplashScreenCtrl} options={{gestureEnabled: false}}/> // or swipeEnabled:false
<Stack.Screen name="Login" component={LoginScreen} options={{gestureEnabled: false}}/>
{/* and 10 more screens*/}
</Stack.Navigator>
);
// and in the render method
return (
<StatusBar backgroundColor="black" barStyle="light-content" />
<NavigationContainer>
<Drawer.Navigator drawerContent={(props) => <CustomDrawer {...props} />} >
<Drawer.Screen name="DrawerScreen" component={StackScreens} />
</Drawer.Navigator>
</NavigationContainer>
);
const StackScreens=({navigation})=>(
//或可切换:错误
{/*还有10个屏幕*/}
);
//在渲染方法中
返回(
} >
);
在屏幕上定义导航选项也不起作用
喜欢
//在LoginScreen.js中
静态导航选项=({navigation})=>({
校长:错,
swipeabled:false,
});
//然后在创建堆栈导航器时
已经很晚了,但它可能对某些人有所帮助
您应该在抽屉声明中放置gestureEnabled:false
<Drawer.Navigator drawerContent={(props) => <CustomDrawer {...props} />} >
<Drawer.Screen name="DrawerScreen" component={StackScreens}
options={{ gestureEnabled: false }}/>
}>
已经很晚了,但它可能对某些人有所帮助
您应该在抽屉声明中放置gestureEnabled:false
<Drawer.Navigator drawerContent={(props) => <CustomDrawer {...props} />} >
<Drawer.Screen name="DrawerScreen" component={StackScreens}
options={{ gestureEnabled: false }}/>
}>
这是一个错误的答案。这将禁用所有屏幕的滑动,而不是某些特定的屏幕。这是一个错误的答案。这将禁用所有屏幕的滑动,而不是某些特定屏幕