"Unrecognized font family...." error using Expo Font

Loading a font this way:

import { Font } from ‘expo’;

async componentDidMount() {

    await Font.loadAsync({
        'Sailec': require('assets/fonts/Sailec-Regular.ttf')
    });

    this.setState({ fontLoaded: true });
}

Then in Text component:

                <Text style={{fontFamily: 'Sailec'}>....</Text>

I’m getting "Unrecognized font family ‘Sailec’ "

I’m using SDK 31.0.0

Hey @dealajota,

With the way your code is set up, can you make sure that the Text component isn’t being rendered until the font has been loaded.

Cheers,

Adam

Hey @adamjnav i have this on the top level component:

render(){ return this.state.fontLoaded ? (<App/>) : null }

@dealajota
Your code looks good ,
Step 1 : check or download .ttf file again.
step 2 : fontWeight should be 400.
Then recheck it.
it may help you.

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