Does not work with react-native >0.18
kengorab opened this issue · 2 comments
I follow all the installation instructions, but when I try to use a component I am presented with this error:
Requiring unknown module "react-native-vector-icons/MaterialIcons". If you are sure the module is there, try restarting the packager or running "npm install".
This was already reported in #30 back in February, the resolution of which was to downgrade to react-native v0.18, because after that version the structure around Java dependencies changed. I didn't see an open issue for solving this problem and supporting the latest versions, so I wanted to open up discussion on how this can be resolved.
What exactly is the problem with using this project against react-native >0.18?
So after some investigation, I've found that following the Android installation steps from the react-native-vector-icons lib actually fixes this issue.
The only change I had to add to my project was to android/app/build.gradle
:
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
The react-native-vector-icons docs say that running rnpm link
should work too (or running react-native link react-native-vector-icons
from within a project which pulls it in as a dependency), but it also says that there have been problems with that. I didn't try it because I'm perfectly fine editing the build.gradle myself.
I didn't have to manually copy the fonts, either. I think the documentation should be updated to include this step. I'll put up a pull request later on today if I get time, but hopefully this thread is discoverable enough by itself for others having this issue.