React native 尝试在react native/native base中的switchNavigator中嵌套抽屉导航器时出错

React native 尝试在react native/native base中的switchNavigator中嵌套抽屉导航器时出错,react-native,native-base,React Native,Native Base,在模拟器中运行IOS应用程序时,我遇到了这个错误 这是我的相关代码 import {createSwitchNavigator, createAppContainer} from "react-navigation" import SideBar from "../App/Components/SideBar" import createDrawerNavigator from "react-navigation-drawer"; //Components import Login from

在模拟器中运行IOS应用程序时,我遇到了这个错误

这是我的相关代码

import {createSwitchNavigator, createAppContainer} from "react-navigation"
import SideBar from "../App/Components/SideBar"
import createDrawerNavigator from "react-navigation-drawer";

//Components
import Login from "../App/Views/Login"
import Categories from "../App/Views/Categories"
import UserProfile from "../App/Views/UserProfile"


const BataDrawerNagivator = createDrawerNavigator({
  Dashboard: {screen: SideBar }
});

const BataNavigator = createSwitchNavigator({
    LoginScreen: Login,
    CategoriesScreen: Categories,
    UserProfileScreen: UserProfile,
    Dashboard:{ screen: BataDrawerNagivator}
  });


  export default createAppContainer(BataNavigator);

我在网上阅读了多个有相同错误的资源,但所有的答案似乎都指向一个不推荐使用的依赖项,我认为这里的情况并非如此


有趣的是,每个导航单独工作都很好,但一旦我尝试嵌套它们,它就会抛出此错误。

您会收到此错误,因为您错误地导入了createDrawerNavigator 改变

希望这有帮助

import createDrawerNavigator from "react-navigation-drawer";
import {createDrawerNavigator} from "react-navigation-drawer";