How to Lock drawer for specific page using drawerNavigation [react-navigation][react-native]

后端 未结 5 1088
感情败类
感情败类 2021-01-04 18:37

This is my drawerNavigation :

const DashboardStack = StackNavigator({
        Dashboard: {
            screen: Dashb         


        
5条回答
  •  忘掉有多难
    2021-01-04 18:52

    Now, things have been changed in react-navigation version-5.

    swipeEnabled is used to lock the drawer in Drawer.Screen inside the Drawer.Navigator

    Visit https://reactnavigation.org/docs/drawer-navigator/#swipeenabled

    Please see the below code:

    import { createDrawerNavigator } from "@react-navigation/drawer";
    import React from "react";
    import { Sidebar } from "./SideBar";
    import { ScreenWithDrawerEnabled } from "./ScreenWithDrawerEnabled";
    import { ScreenWithDrawerDisabled } from "./ScreenWithDrawerDisabled";
    
    const Drawer = createDrawerNavigator();
    
    export const DashboardDrawerNavigator = () => (
       }
      >
        
         {
            return {
              swipeEnabled: false,
            };
          }}
          name={'ScreenWithDrawerDisabled'}
          component={ScreenWithDrawerDisabled}
        />
    
      
    );
    

提交回复
热议问题