0

I'm having an issue with react-native-vector-icons. I have it install as a dependency and peerDependency, but when I install my NPM Package into a project, I'm getting an error. To my understanding, a peerDependency is a dependency used for npm packages so packages of my NPM library are installed. Is that correct?

In my NPM library, I have manually linked react-native-vector-icons in my podfile and info.plist:

podfile

pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'

info.plist

<key>UIAppFonts</key>
<array>
  <string>AntDesign.ttf</string>
  <string>Entypo.ttf</string>
  <string>EvilIcons.ttf</string>
  <string>Feather.ttf</string>
  <string>FontAwesome.ttf</string>
  <string>FontAwesome5_Brands.ttf</string>
  <string>FontAwesome5_Regular.ttf</string>
  <string>FontAwesome5_Solid.ttf</string>
  <string>Foundation.ttf</string>
  <string>Ionicons.ttf</string>
  <string>MaterialIcons.ttf</string>
  <string>MaterialCommunityIcons.ttf</string>
  <string>SimpleLineIcons.ttf</string>
  <string>Octicons.ttf</string>
  <string>Zocial.ttf</string>
</array>

package.json

 "dependencies": {
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-modal": "^11.5.3",
    "react-native-vector-icons": "^6.6.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "@types/jest": "^24.0.24",
    "@types/react-native": "^0.60.25",
    "@types/react-native-vector-icons": "^6.4.5",
    "@types/react-test-renderer": "16.9.1",
    "@typescript-eslint/eslint-plugin": "^2.12.0",
    "@typescript-eslint/parser": "^2.12.0",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-test-renderer": "16.9.0",
    "typescript": "^3.7.3"
  },
  "peerDependencies": {
    "react": "*",
    "react-native": "*",
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-modal": "^11.5.3",
    "react-native-vector-icons": "^6.6.0"
  },
jefelewis
  • 1,850
  • 1
  • 27
  • 63
  • which version of Rn are you using? – Gaurav Roy Feb 01 '20 at 07:19
  • I'm on version 0.61.5 – jefelewis Feb 01 '20 at 07:21
  • You're using ```react-native``` version ```0.61.5```, which means that you don't need to manually link ```react-native-vector-icons```, cause this new version of react-native came with an autolinking feature. By the way, what's the error that you're getting? – mindmaster Feb 01 '20 at 10:59
  • Error: undefined Unable to resolve module 'react-native-vector-icons/Ionicons' from 'node_modules/react-native-contact-action-sheet/dist/ContactActionSheet.js': react-native-vector-icons/Ionicons could not be found within the project – jefelewis Feb 01 '20 at 21:40
  • ^ That's the error when I try to automatically link react-native-vector-icons. I install my library react-native-contact-action-sheet to a fresh project, and that's the error. Not sure how to do this, but I need react-native-vector-icons to be installed when my NPM Package is installed – jefelewis Feb 01 '20 at 21:41

0 Answers0