I am trying to add fonts to my application following this instruction:
if I try to add another font then the application gives the following error:
I am trying to add fonts to my application following this instruction:
if I try to add another font then the application gives the following error:
Hey @george_kulishavili, what exactly is the error? The screenshot shows the offending code but no error message.
actually i try connect 2 google fonts but i can’t. With 1 font all is good. What’s wrong with code ?
Screenshot_1|460x500
I get next error:
Parsing error: Identifier ‘useFonts’ has already been declared
Code: honest macaroni and cheese - Snack
Hi
I’m not sure why they decided to copy useFonts
into each of the fonts, but it’s also available in the expo-font
package.
All the copies of useFonts
are the same, so you could just import it from the first font and use it for both of them. Or you could rename it using useFonts as usePoppinsFonts
and use that hook to load the Poppins fonts. But I think it’s simpler and clearer if you import useFonts
from expo-font
instead.
Also, you’re loading the font families separately, but you may as well load them all at once. Then you won’t run into problems with two fontsLoaded
variables.
See the following snack that I based on yours:
Thank you!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.