bl00mber / react-phone-input-2

:telephone_receiver: Highly customizable phone input component with auto formatting
https://bl00mber.github.io/react-phone-input-2.html
MIT License
953 stars 543 forks source link

🇻🇳 [VN] Can't enter enough digits to satisfy format #556

Open hypnoboutique opened 2 years ago

hypnoboutique commented 2 years ago

You can't enter enough digits for Vietnam to satisfy the expected format.

This means I cannot enter a valid Vietnamese phone number.

Try it here: https://bl00mber.github.io/react-phone-input-2.html

The expected format is:

Screenshot 2022-07-14 at 07 49 04

There may well be others, I just stumbled upon this one.

hypnoboutique commented 2 years ago

While I'm down here... it would be AMAZING if the guessCountry method could be exposed for other validators to use.

eg. I'm using react-hook-form with Yup for validation. The schema is defined a few components up and I would like to use this package's methods to validate where I define the schema.

Because I can't access the guessCountry method, I'm having to hold state at my form schema level and drill an error setter through to the PhoneInput, where I can use the (unusual) onChange args - data, to be specific - to perform some basic length validation.

Sorry. Maybe I'll PR it if I get time 🤷