0

When using react-native-vector-icons on web, you have to use react-native-vector-icons/dist, per the README.

However, on a native app this results in an error that "react-native-vector-icons/dist" is not in the hashmap and couldn't be resolved.

What is the best way to conditionally import and use the dist/ folder only on the web? I'm using Expo, so I can use Expo (Platform.OS === 'web') for the condition, but I'm not sure if it makes sense to put an async operation into the render method of the view?

Something like this maybe - https://medium.com/@magbicaleman/intro-to-dynamic-import-in-create-react-app-6305bb397c46

Varun Singh
  • 1,676
  • 3
  • 18
  • 25
  • Do you get that error upon import or when you attempt to use an icon from it? – Zaytri Jun 14 '19 at 18:00
  • Upon import. I tried to use the dynamic imports that I linked to but that also generates an error, so it appears that the issue is in the importing, and that react-native or expo is still importing things statically and not dynamically / asynchronously. – Varun Singh Jun 14 '19 at 20:28

0 Answers0