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

#1

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

#2

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

#3

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

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

@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.

closed #5

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