禁用抽屉(sideMenu)的特定视图

时间:2019-12-02 13:55:37

标签: react-native react-navigation

默认情况下,我可以在“详细信息”视图中打开抽屉,但是我想防止这种情况,以便在向左滑动时可以显示抽屉,但仅适用于此视图。我该怎么做?

enter image description here

import React from "react";
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import { createStackNavigator } from "react-navigation-stack";
import { createDrawerNavigator } from "react-navigation-drawer";
import SideBar from "../components/SideBar/SideBar";
import { STYLES } from "../styles/Styles";
import LoginScreen from "../screens/Login/Login";
import HomeScreen from "../screens/Home/Home";
import DetailScreen from "../screens/DetailScreen/DetailScreen ";
const LoginStack = createStackNavigator(
{
    Login: {
    screen: LoginScreen,
    navigationOptions: {
        title: "Login",
        headerLeft: null,
        header: null
    }
    }

},
{
    initialRouteName: "Login"
}
);

const HomeStack = createStackNavigator(
{
    Home: {
    screen: HomeScreen,
    navigationOptions: {
        title: "Cita",
        headerLeft: null,
        header: null
    }
    },
    Detail: {
    screen: DetailScreen,
    navigationOptions: {
        title: "Detail cita",
        headerStyle: STYLES.bgHeaderBack,
        headerTintColor: "#fff",
        headerMode: "none"
    }

},
{
    initialRouteName: "Home",
    headerMode: "none"
}
);

const DrawerStack = createDrawerNavigator(
{
    Home: {
    screen: HomeStack
    }
},
{
    contentComponent: SideBar
}
);

const switchNavigator = createSwitchNavigator(
{
    LoginStack: LoginStack,
    HomeStack: DrawerStack
},
{
    headerMode: "none",
    initialRouteName: "LoginStack"
}
);

const AppContainer = createAppContainer(switchNavigator);
export default AppContainer;

0 个答案:

没有答案