Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 将手势/滑动设置为false不起作用[react navigation v5]_Reactjs_React Native_React Navigation_React Navigation Stack_React Navigation Drawer - Fatal编程技术网

Reactjs 将手势/滑动设置为false不起作用[react navigation v5]

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"

在react本机应用程序中,我希望在某些屏幕上禁用抽屉。所有屏幕都堆叠并传递到
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 }}/>
}>

这是一个错误的答案。这将禁用所有屏幕的滑动,而不是某些特定的屏幕。这是一个错误的答案。这将禁用所有屏幕的滑动,而不是某些特定屏幕