5

I'm using Expo and react-native-paper. In the react-native-paper docs it says: "If you use Expo, you don't need to install vector icons"

The icons work on the web version in Expo, but not on Android (emulator or through the app).

On Android I get this error: Unable to resolve "react-native-vector-icons/MaterialCommunityIcons" from "node_modules\react-native-paper\src\components\MaterialCommunityIcon.tsx"

Tried the solutions below (even though I think I'm not supposed to use these when using Expo)

  • If I install the react-native-vector-icons package, I get the error: fontFamily "MaterialCommunityIcons" is not a system font and has not been loaded through Font.loadAsync

  • Trying solutions in here: Running react-native link react-native-vector-icons doesn't seem to help. Can't access Android Gradle when using Expo.

Package versions:

    "@expo/vector-icons": "^12.0.0",
    "expo": "~40.0.0",
    "expo-file-system": "~9.3.0",
    "expo-font": "~8.4.0",
    "expo-status-bar": "~1.0.3",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-hook-form": "^6.13.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz",
    "react-native-paper": "^4.4.1",
Otju
  • 51
  • 2
  • 1
    did u manage to find any solution. I am also facing a similar issue. – Ravi Kant Mishra Dec 18 '20 at 14:33
  • 1
    Currently my temporary solution is to install _react-native-vector-icons_, and then manually switch each react-native-paper components icon prop to: `icon={() => }` This gets rid of the error and shows the icons, but is a bad solution because I have to manually add the icons, manually add theming/styles to them and it doesn't work for some react-native-paper components that don't have props for all their icons. – Otju Dec 20 '20 at 09:31

0 Answers0