oblador / react-native-vector-icons

Customizable Icons for React Native with support for image source and full styling.
https://oblador.github.io/react-native-vector-icons/
MIT License
17.39k stars 2.12k forks source link

FontAwesome Pro fonts not working #852

Closed WazzupTom closed 5 years ago

WazzupTom commented 5 years ago

Hi,

I tried installing the fontAwesome Pro version by running the ./node_modules/.bin/fa5-upgrade command as specified here: https://github.com/oblador/react-native-vector-icons/blob/master/FONTAWESOME5.md#upgrading-to-pro

This didn't work, and gave an error that it couldn't find the package.json. I read the other issue regarding this: https://github.com/oblador/react-native-vector-icons/issues/840

I changed my package.json file to: "react-native-vector-icons":"oblador/react-native-vector-icons" and it actually downloaded the files, but then gave an error that it couldn't find the files in the correct folder.

I took a look at the shell script, and it basically just copies the files from the webfonts folder to the /root/assets/fonts folder and then links it in the package.json. I tried doing this manually and I can see that the files appeared in the android and ios folders.

However, when I try and use the control, all I get is crosses instead of icons, example of the code:

import FontAwesome5Pro from "react-native-vector-icons/FontAwesome5Pro"; <FontAwesome5Pro size={20} name={"calendar"} light />

Is there any way I can fix it so I can use the pro version of the icons? Thanks.

hampustagerud commented 5 years ago

Is this Android/iOS/both?

There is https://github.com/oblador/react-native-vector-icons/issues/842 which handles a problem with naming on Android. On iOS it could be that you didn't add the fonts to your Info.plist? Check the docs for information on that. If you have added the fonts in your package.json you could run react-native link react-native-vector-icons and they should be copied automatically (though I believe the issue with naming on Android still persists).

You could also try removing the package completely and reinstall it. Maybe it would work, maybe not 🙂

Good luck!

WazzupTom commented 5 years ago

Thanks, it was indeed the naming issue that was the problem. I renamed the files like in issue #842 and now the fonts are working.

Bit of a hassle, but glad it's working now. Thanks for the help.

danielidt commented 5 years ago

@hampustagerud can you elaborate what exactly we need to rename? I upgraded to pro using the script, but icons show up as empty boxes with an x.

What do we rename and where? Sorry its not clear