patw0929 / react-intl-tel-input

Rewrite International Telephone Input in React.js. (Looking for maintainers, and PRs & contributors are also welcomed!)
https://patw0929.github.io/react-intl-tel-input/
MIT License
282 stars 221 forks source link

Country options don't work if "countriesData" is passed #402

Open anetecima opened 1 year ago

anetecima commented 1 year ago

Country data is undefined if passed through countriesData prop

Expected Behavior

countries should be displayed the same as when the country data isn't passed.

Current Behavior

Screenshot (498) can be checked here - https://codesandbox.io/s/nervous-dust-nwh12t?file=/src/App.js

anetecima commented 1 year ago

the issue is the format that countriesData is expected in. in documentation it's countriesData?: CountryData[] | null where countryData is an object while in reality an array is expected for each country. the initialization should be removed if countriesData is passed or the format changed to this - ['Cambodia (កម្ពុជា)', 'kh', '855'] I'd be happy to fix this, but I need permission to push a new branch.