goveo / react-international-phone

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

Support all ISO 3166-1 alpha-2 country codes? #53

Open eric-wren opened 1 year ago

eric-wren commented 1 year ago

Our website allows people to enter their country, including options like "Cayman Islands" (KY), before they get to the step where they enter their phone number. However, we cannot set the Cayman Islands as the defaultCountry for such users.

It would be great if this component could support all 249 assigned country codes: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

We could add additional countries ourselves, but we'd have to look up the dialing code and format for each one ourselves, and maintain. Without this, we will have to fall back to having no defaultCountry; and when the user enters a Cayman Islands phone number, for example, the component will incorrectly show a US flag.

DfTopas commented 1 year ago

Yeah, same goes for our website, where most of our users are from Greenland, and it is missing GL :(

Vilchynskyi commented 5 months ago

Our users from the Cayman Islands can't type their phone too(

Loschcode commented 5 months ago

I posted 2 unrelated issues that are blockers for me too a few days ago and nobody replied, so I checked the older open issues and realized the list of countries is incomplete indeed.

It's been one full year and the person in charge didn't add those countries — which appears as a simple improvement — so I'm quite worried about using this library in the end.

Shouldn't we fork it / add a pull request and add i18n / all countries? Have you found an alternative on your end? Just curious before I eventually code it myself.

goveo commented 5 months ago

Sorry for the long response, didn't have time for the library 😞 Right now working on the Cayman Islands and Greenland country implementation.

I'm not sure that I will implement all country codes for now... But I will provide a guide for how you can add any new country to the list.

goveo commented 5 months ago

@eric-wren @DfTopas @Vilchynskyi The Cayman Islands and Greenland support was added in v 4.2.8 PR: https://github.com/goveo/react-international-phone/pull/177