React Native Elements 图标(react-native-vector-icons)显示问号而不是实际图标

问题描述 投票:0回答:1

我遇到的问题是,react-native-vector-icons 中的 React Native 元素上的图标未显示,而是显示为问号。

我什至尝试进入这个图标目录并尝试使用名称,但没有成功。 https://oblador.github.io/react-native-vector-icons/

这就是现在的样子。 IOS Preview

这就是我获取 package.json 的方式

{
  "name": "LimitCalisthenics",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/masked-view": "^0.1.11",
    "@react-navigation/native": "^5.9.8",
    "@react-navigation/stack": "^5.14.9",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "pod-install": "^0.1.38",
    "react": "18.2.0",
    "react-native": "0.72.0",
    "react-native-gesture-handler": "^2.12.0",
    "react-native-reanimated": "^3.3.0",
    "react-native-safe-area-context": "^4.6.3",
    "react-native-screens": "^3.22.0",
    "react-native-vector-icons": "^9.2.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.6",
    "@tsconfig/react-native": "^3.0.0",
    "@types/metro-config": "^0.76.3",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.5",
    "prettier": "^2.4.1",
    "react-test-renderer": "18.2.0",
    "typescript": "4.8.4"
  },
  "engines": {
    "node": ">=16"
  }
}

安装 React Native Elements 时遵循本指南 https://reactnativeelements.com/docs/installation

这就是我的组件的方式 https://codeshare.io/9OJA37

  • Macbook Pro M1
  • 文图拉操作系统
  • NodeJS 16
  • IOS(用于在 XCode 上测试的模拟器)
  • React Native CLI
ios node.js reactjs swift react-native
1个回答
3
投票

按照此链接中的步骤进行操作https://github.com/oblador/react-native-vector-icons并确保执行必要的步骤以正确实现适用于 android 和 ios 的 React Native 矢量图标

© www.soinside.com 2019 - 2024. All rights reserved.