Reputation: 139
For example, I have +92 phone code for Pakistan and I want to convert it to iso2( e.g Pakistan's iso2 is 'PK'). So, is there any library to do this? I have tried 'country-code-lookup' but it is giving wrong result.
import * as lookup from 'country-code-lookup';
lookup.byIso(parseInt('+92'))
It should return an object with iso2 'PK', but it is giving me a wrong result. I have also tried lookup.byIso(parseInt('92'), without + at parameter, but still getting wrong result! Your help would be appreciable! Thanks
Link of country-code-lookup : https://github.com/richorama/country-code-lookup
Upvotes: 0
Views: 657
Reputation: 463
Try to use React Native Phone Number Input package:
https://reactnativecode.com/react-native-phone-number-input/
Upvotes: 1