Closed Talha8598 closed 2 years ago
I've figured out why does it parse text "1 111 111 1111 1"
as a national "significant" number "+1 111 111 1111"
.
As soon as the user has input "11"
, no format
matches those "national number" digits in the "US"
country metadata. Since no format
matches, the number doesn't seem like a valid one, so it attempts to see if the user "forgot" to input a "+"
at the start. And it looks like they might've to. So it acts as if the leading "+"
is there, as if the user's input is "+11"
. See AsYouType.fixMissingPlus()
function.
So, since national "significant" number "+1 111 111 1111"
, the limitMaxLength
feature is working as expected.
limitMaxLength
operates on national "significant" number, not on the user's input.
if i use normal phone number then it works fine but if i repeat the country code if accepts number greater then specified in limitMaxLength, as you can see below it is giving three different results for three different input formats
Code:
<PhoneInput placeholder="Enter phone number" value={"0900786012131312"} defaultCountry={"US"} limitMaxLength={true} onChange={(newVal)=>console.log(newVal)} />