react-native-global-props icon indicating copy to clipboard operation
react-native-global-props copied to clipboard

add custom fonts expo

Open waltershub opened this issue 7 years ago • 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

waltershub avatar Jan 01 '18 04:01 waltershub

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?

jacobsmith avatar Jun 18 '18 18:06 jacobsmith

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 (:

jacobsmith avatar Jun 19 '18 20:06 jacobsmith