无法解析“ App.js”中的“反应导航抽屉”

时间:2020-05-26 15:31:10

标签: javascript reactjs react-native react-navigation react-navigation-drawer

我的反应导航抽屉不起作用,运行该应用程序时出现此错误,任何解决此问题的建议。

Unable to resolve "react-navigation-drawer" from "App.js"

import React from 'react';

import {createAppContainer} from 'react-navigation';
import {createDrawerNavigator} from 'react-navigation-drawer';
import {Dimensions} from 'react-native';

import {Feather} from 'expo/vector-icons'
import { ProfileScreen, MessageScreen, ActivityScreen, ListScreen, ReportScreen, StatisticsScreen, SignoutScreen} from './screens';

const DrawerNavigator = createDrawerNavigator({
  ProfileScreen,
  MessageScreen,
  ActivityScreen,
  ListScreen,
  ReportScreen,
  StatisticsScreen,
  SignoutScreen
})

export default createAppContainer(DrawerNavigator);

2 个答案:

答案 0 :(得分:0)

您尚未在项目中安装react-navigation-drawer,并尝试使用它。

在项目目录中运行yarn add react-navigation-drawer,它应该可以工作。

答案 1 :(得分:0)

尝试更改import {createDrawerNavigator} from 'react-navigation-drawer';import {createDrawerNavigator} from "@react-navigation/drawer";