Closed nikhilsarvaiye closed 4 years ago
It's not clear what you're talking about
If you look at below image, there two number which has been set from record. Both values are getting set properly to phone control, but only first one show US country selected flag as valid. Any reason why other doesn't show, is it because its invalid?
isValidPhoneNumber
shows the second number as invalid, can we have some input configuration like named validationType
on whether to use isValidPhoneNumber
or isPossiblePhoneNumber
for validation?
Currently I am using isPossiblePhoneNumber
for error message validation but library is using isValidPhoneNumber
internally.
I see, so the issue being reported is that the second number's country isn't autodetected. This is the expected behavior, until Google's library demo returns different results. So you can check that in Google's demo if you want.
isValidPhoneNumber
shows the second number as invalid
Then it's not valid
, can we have some input configuration like named
validationType
on whether to useisValidPhoneNumber
orisPossiblePhoneNumber
for validation?
This component doesn't use any validation internally, so it's not clear what you mean.
Currently I am using
isPossiblePhoneNumber
for error message validation but library is usingisValidPhoneNumber
internally.
This library isn't using any validation internally.
I'll close this issue because the behavior is expected (though many people don't understand why it's expected because it's how libphonenumber-js
works).
If you try below numbers
+1 785 456 5456
-- does work+1 456 456 5456
-- does not workBelow configuration
<PhoneInput international limitMaxLength name={name} value={value} onChange={setValue} defaultCountry='US' useNationalFormatForDefaultCountryValue={false} addInternationalOption={false} displayInitialValueAsLocalNumber={false} countryOptionsOrder={['US', 'CA', 'AU', 'IN', '...']} />
Any way we can disable this behavior?