Ajackster/react-native-global-props

add custom fonts expo

Opened this issue · 2 comments

the package works fine for fonts that are already supported but how about using it on a custom
expo provides this method
componentWillMount() {
Font.loadAsync({
'open-sans-bold': require('./assets/fonts/Quicksand-Regular.ttf'),
});

but it not working with the setCustomText(customTextProps);
i think its because by the time the font is loaded the props have already been passed in and failed

I'm also running in to a similar problem, though I'm not calling setCustomText until after the promise from Font.loadAsync returns. @waltershub did you ever find a solution?

After some more work, I realized that I had not initialized the application according to how Expo wanted it initialized and that was causing Font.loadAsync not to complete as expected.

I used https://docs.expo.io/versions/latest/sdk/register-root-component to transition an earlier, non-Expo app to register properly with expo and then the Font.loadAsync started working properly. Hope this helps some future lost soul (: