Skip to content

Custom mask for all country #65

Answered by goveo
jovanhartono asked this question in Q&A
Discussion options

You must be logged in to vote

@jovanhartono Thanks!
You can pass the country param with modified format country values:

const countries = defaultCountries.map((country) => {
  const parsedCountry = parseCountry(country);

  return buildCountryData({
    ...parsedCountry,
    format: '...-....-....',
  });
});

export const App = () => {
  return <PhoneInput countries={countries} defaultCountry="ua" />;
};

But this example doesn't handle dial-code value, so this will be supported:

  • +1 123-4567-8901
  • +43 123-4567-8901
  • +380 123-4567-8901

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jovanhartono
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants