Closed phil-hudson closed 7 months ago
I am seeing this too, I am trying to troubleshoot why my old toolbar wrapper class on Android stopped working. So I just plugged in the Android toolbar example that's in this package's README, and I am getting the same error as above. And I am on the same version of React-native as the above comment, and also using Hermes
@phil-hudson were you able to fix this error? I thought it would get resolved by making sure that expo-presets babel plugin is eliminated (as it tries to substitute react-native-vector-icons package with its own branch). But that did not help. I also migrated to RN 0.73.2 and that did not help either.
@phil-hudson I tracked down my issue to an incorrect import statement (not sure if this something i changed accidentally, or something changed in RN Vector icons in the latest releases) But I had used { } to import Icon class, and instead it should have been simply (as per documentation): ''' import Icon from 'react-native-vector-icons/dist/Ionicons'; '''
Without the correct import any function called on the Icon object instance (eg getImageSource or getImageSourceSync, or even .hasName) would fail. I started debugging it by checking if Icon.getImageSource is even a type of function -- and it was returning me 'no'. That's how I realized that the Icon object instance was missing function signatures.
I double checked that my android gradle and settings.gradle are correctly setup. then I also double-checked that expo is not overriding the react-native-vector-icons with its own copy of react-native-vector-icons (unfortunately this happens by default, when babel-preset-expo preset is used in babel config).
Once I eliminated the above potential setup issues, I just noticed the import statement issue, fixed that -- and it is working.
So I can confirm that react native vector icons on Android works in the presence of expo 50.0.11 and React-native 0.73.4
@phil-hudson if @vladp fix doesn't work for you can you reopen
Environment
Description
Describe your issue in detail. Include screenshots if needed.
Static methods on the icon class look to be undefined - possibly a resolution issue?
Example code:
ERROR TypeError: _Ionicons.default.getImageSourceSync is not a function (it is undefined), js engine: hermes
Reproducible Demo
Let us know how to reproduce the issue. Include a code sample, share a project, or share an app that reproduces the issue using https://snack.expo.io/. Please follow the guidelines for providing a MCVE: https://stackoverflow.com/help/mcve