xcarpentier / react-native-country-picker-modal

🇦🇶 Country picker provides a modal allowing a user to select a country from a list. It display a flag next to each country name.
https://reactnative.gallery/xcarpentier/country-picker
MIT License
1.07k stars 795 forks source link

Canada flag doesn't persist because it shares the same code as US #504

Open Jcg408 opened 1 year ago

Jcg408 commented 1 year ago

Issue Description

When switching to Canada and inputting a valid phone number with Canadian area code, the number is registered as a US number. This is due to the fact that North American countries all have +1 as the calling code. I

This issue doesn't happen with Puerto Rico (although a separate problem is changing the code for Puerto Rico with 2 area codes) because the code is appended with area codes.

Steps to Reproduce / Code Snippets

Select Canada in the modal and input a phone number. Refresh and the flag has switched to US flag.

Expected Results

Select Canada in the modal and input a phone number. Refresh and the flag should remain as Canada. This should occur if the number is not on the Canadian area code as well. If the Country Code is set as "CA" it should not change to something else!

Additional Information