Font.loadAsync resolves but the default font is used

Hi, I’ve just upgraded from sdk 30 to 31 (and changed a lot along the way). Now, my app shows everything in the default font and not my custom font.

In my root App component:

    await Font.loadAsync({
      'MaterialIcons': require('./assets/MaterialIcons.ttf'),
    });
    this.setState({fontLoaded: true});
  }

and in other places I use <Text style={{fontFamily: 'MaterialIcons'}}>. I observe the fontLoaded = true firing. But the components render with the default font. Also, I’ve noticed I can change the fontFamily in the style to anything and it is the same. Previously, I thought it would throw an error when trying to render a font that hadn’t loaded yet.

I’ve tried various renames of the font & file, nothing works. I also tried a refactor to match the format at https://github.com/expo/new-project-template/blob/master/App.js but it’s still the same.

I do get an error if I try to require a different path than the actual font path, so that’s something.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.