Serdar Gun
Serdar Gun

Reputation: 97

console.error:"fontFamily "layar-bahtera-regular" is not a system font and has not been loaded through Font.loadAsync

Everything was okay before I upgrade Expo SDK to 35 and I face this issue now. layar-bahtera-regular is my custom font and I used Font.loadAsync already. What is the problem?

  import * as Font from 'expo-font';

  state = { fontLoaded: false }

  async componentDidMount() {
    await Font.loadAsync({
      'layar-bahtera-regular': require('../../assets/fonts/LayarBahteraDdW01Regular.ttf')
   });

  this.setState({ fontLoaded: true });

}

Upvotes: 3

Views: 488

Answers (1)

mtshv
mtshv

Reputation: 66

did you try doing this after the upgrade?

  • Delete the node_modules folder
  • Delete the package-lock.json file
  • Run npm/yarn install

Also, you can try executing this command expo install expo-font

Let me know, if it helped

Upvotes: 1

Related Questions