【问题标题】:react-native-vector-icons/AntDesign could not be found within the project-Android在项目-Android 中找不到 react-native-vector-icons/AntDesign
【发布时间】:2020-02-27 08:32:12
【问题描述】:

我面临以下问题。

Error: Unable to resolve module `react-native-vector-icons/AntDesign` from `node_modules/react-native-elements/src/helpers/getIconType.js`: react-native-vector-icons/AntDesign could not be found within the project.

包.json

{
  "name": "GeoLocation",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/geolocation": "^2.0.2",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-elements": "^1.2.7",
    "react-native-fused-location": "^1.1.1",
    "react-native-get-location": "^1.4.2",
    "react-native-vector-icons": "^4.6.0"
  },
  "devDependencies": {
    "@babel/core": "7.8.4",
    "@babel/runtime": "7.8.4",
    "@react-native-community/eslint-config": "0.0.5",
    "babel-jest": "24.9.0",
    "eslint": "6.8.0",
    "jest": "24.9.0",
    "metro-react-native-babel-preset": "0.56.4",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

我已完成以下链接中提到的所有步骤。

Unable to resolve module 'react-native-vector-icons/AntDesign''

【问题讨论】:

  • android/app/build.gradle中添加字体列表了吗?

标签: android react-native


【解决方案1】:

我已经看到你的代码我想告诉你,首先你应该编辑你的package.json 并升级react-native-vector-icons 版本 "react-native-vector-icons": "^4.6.0","react-native-vector-icons": "^6.6.0",,然后删除你的 node 模块文件夹,然后运行 ​​npm install 命令,然后在你的文件中导入矢量图标,如下所示:-

import AntDesign from "react-native-vector-icons/AntDesign"

如果您仍然遇到任何问题,请随时再次询问。

【讨论】:

    猜你喜欢
    • 2020-02-01
    • 2018-12-25
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-27
    • 1970-01-01
    相关资源
    最近更新 更多