goveo / react-international-phone

☎️ International phone input component for React
https://react-international-phone.vercel.app/
MIT License
277 stars 54 forks source link

Add masking for AE ISO2 #155

Open mamo-muj opened 7 months ago

mamo-muj commented 7 months ago

Hi there, I was looking at the data and there's some countries that are missing masking for the phone numbers. I'm sure that we have masking for ae country - ... .. ... ...., however, I didn't see that in there. Is there a way that I can extend this and add it myself?

Thank you for all the work on this package! It's been super helpful 🔥

mamo-muj commented 7 months ago

I tried something like this and this worked. Although if we could add it into the package itself that would be great as well

// Defining the list of ISO2 codes of countries to be excluded
const excludedCountries = ["ae"];

// Filter out excluded countries from the defaultCountries array
const filteredCountries = defaultCountries.filter(country => !excludedCountries.includes(country[1]));

// Add masking for UAE country manually
filteredCountries.push(["United Arab Emirates", "ae", "971", ".. ... ...."]);

// Sort the filteredd countries alphabetcially by country name
filteredCountries.sort((a, b) => a[0].localeCompare(b[0]));
Vilchynskyi commented 1 month ago

I support this update!

yaroshanton commented 1 month ago

I'm having the same problem, needs fixing, please!