google-fonts icon indicating copy to clipboard operation
google-fonts copied to clipboard

Not working on web, font source is missing uri prop

Open Njaah-0 opened this issue 4 years ago • 2 comments

Hi, I tried to use this package in pretty fresh project, but run into an issue where nothing happened. My code looks like this: Screenshot 2020-07-11 at 11 03 22

fontsLoaded stays false and error is always null (but that's another issue). I then did some digging and found out that font source passed to loadAsync looks like this: Screenshot 2020-07-11 at 11 04 48 But then the FontLoader.web.js in expo-font package expects that object passed to it has property called uri, otherwise invalid source error is thrown.

I modified FontLoader.web.js code like this and it started working, but maybe this package should add this uri prop when user is on web? Screenshot 2020-07-11 at 11 07 45

Njaah-0 avatar Jul 11 '20 08:07 Njaah-0

Still relevant in 2022.

Thanks so much for sharing

danieloi avatar Apr 19 '22 14:04 danieloi

@Njaah-0 Is it necessary to modify the code behind useFonts (FontLoader.web.js) to use it on the web? Could you share your solution or explain what you did a bit further? thx

rodbs avatar Apr 19 '22 15:04 rodbs