AstrOOnauta / react-native-international-phone-number

โš›๏ธ International mobile phone number input component for React Native ๐Ÿ“ฑ
https://snack.expo.dev/@astroonauta/react-native-international-phone-number
ISC License
272 stars 44 forks source link

Issue load TwemojiMozilla font #39

Closed ser-emejia closed 11 months ago

ser-emejia commented 11 months ago

After update my project to new version v0.6.7 I'm facing issues to load the font, see screenshot bellow:

Screenshot 2023-11-29 at 9 54 37โ€ฏa m

I followed this suggestion but it does not work.

Thank you for your help!

AstrOOnauta commented 11 months ago

Hey @ser-emejia

Are you using Expo, right? Do you followed the lib documentation and installed the dependency expo-font to load the font TwemojiMozilla?? See the official documentation here about custom fonts with Expo or see my example and follow it.

Please, let me know if this dont fix your issue...

๐Ÿš€ AstrOOnauta๐Ÿš€

ser-emejia commented 11 months ago

lib documentation

Yes, I'm using expo, I followed the documentation as you mentioned but same result

Unable to resolve "../../node_modules/react-native-international-phone-number/lib/assets/fonts/TwemojiMozilla.woff2" from "src/utils/index.ts

I load the font in that way:

export const customFonts = {
...mycustomfonts,
  TwemojiMozilla: require('../../node_modules/react-native-international-phone-number/lib/assets/fonts/TwemojiMozilla.woff2'),
};
AstrOOnauta commented 11 months ago

@ser-emejia can you put the font TwemojiMozilla (from lib) inside a folder called assets on root of your project (like the example)? Sometimes the Expo has conflicts with this...

So you customFonts will be like this:

export const customFonts = {
...mycustomfonts,
  TwemojiMozilla: require('./assets/TwemojiMozilla.woff2'),
};
ser-emejia commented 11 months ago

Same result, I downloaded the font and to my assets folder, but the problem is the same:

Unable to resolve "../../assets/fonts/TwemojiMozilla.woff2" from "src/utils/index.ts"

By the way,

checking expo documentation I noticed that wff2 font is not supporting in Android

AstrOOnauta commented 11 months ago

@ser-emejia Im studying a solution for you case..sorry about this :X

AstrOOnauta commented 11 months ago

@ser-emejia I released a new version fixing this issue! The TwemojiMozilla font will be necessary only to Web version now..

You dont need more load this font to Android or iOS (only Web version now). So, please update your lib to latest v0.7.0.

Please, let me know if this fix your trouble...

๐Ÿš€ AstrOOnauta ๐Ÿš€

ser-emejia commented 11 months ago

Thank you so much for your help and time, it works now on expo, in both, iOS and Android ๐Ÿš€

agrittiwari commented 2 months ago

It's been some time, but I am seeing the same error while loading the font for web. @AstrOOnauta I am running react native web. and it breaks. Is there something missing?