catamphetamine / react-phone-number-input

React component for international phone number input

Home Page:http://catamphetamine.gitlab.io/react-phone-number-input/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can i change the flag to the country code?

adityanegara opened this issue · comments

For example if i pick 'Indonesia' can the selected options render '+62' not Indonesia Flag?

What?

We do the same thing (because the flag icons are ugly):

image

We generate an object with all the country calling codes and pass it to the flags attribute:

const flagOptions = useMemo(() => Object.fromEntries(getCountries().map((country: Country) => (
    [country, () => <>+{getCountryCallingCode(country)}</>]
))), []);
flags={flagOptions}