Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can i change the flag to the country code? #397

Open
adityanegara opened this issue Jan 6, 2022 · 2 comments
Open

Can i change the flag to the country code? #397

adityanegara opened this issue Jan 6, 2022 · 2 comments

Comments

@adityanegara
Copy link

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

@catamphetamine
Copy link
Owner

What?

@michael5r
Copy link

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants