How to add a font to react-native-macos?

81 views Asked by At

I am trying to install react-native-vector-fonts and have followed the instructions at

https://github.com/oblador/react-native-vector-icons

I then imported the font:

import Icon from 'react-native-vector-icons/FontAwesome';
Icon.loadFont();

and then use it in the following way:

 <Icon name="rocket" size={30} color="#900" />

However I get the following error: Unrecognized font family FontAwesome.

I have also followed the instructions at:

https://github.com/oblador/react-native-vector-icons#red-screen-with-unrecognized-font-family-error-on-ios

but I am still receiving the error Unrecognized font family FontAwesome.

I have ensured the following exists in my macos/myapp-macOS/Info.plist file:

    <key>ATSApplicationFontsPath</>
    <array>
        <string>Fonts</string>
    </array>

How do I solve this?

0

There are 0 answers