react-nativeexporeact-native-vector-icons

Expo vector-icons, font not loading


Getting the following error in relation to Expo/vector-icons ever since upgrading to Expo 34.

fontFamily "FontAwesome" is not a system font and has not been loaded through Font.loadAsync.

  • If you intended to use a system font, make sure you typed the name correctly and that it is supported by your device operating system.

  • If this is a custom font, be sure to load it with Font.loadAsync.

I have tried manually loading the font in App.js with

Font.loadAsync({FontAwesome: require("../node_modules/@expo/vector-icons/build/vendor/react-native-vector-icons/Fonts/FontAwesome.ttf")})

but it has no effect. I have updated expo-font to the latest version, cleared node_modules and package-lock, and rebuilt the project.

Any clues?


Solution

  • Not a fix but a workaround as I had the same problem and couldn't find a solution.

    Try changing

    import Font from 'expo-font';
    

    to

    import {Font} from 'expo';
    

    Edit: Looks like there might be a fix for the issue I was experiencing, try updating to expo@34.0.3 and expo-font@6.0.1