fix: [Hotfix]No phone number is valid (#9258)

* Fix invalid phone number always

* Fix countrycode detection
pull/9259/head^2
Hariom Balhara 2023-06-01 15:17:18 +05:30 committed by GitHub
parent 268f1872e4
commit b1019d6bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -30,7 +30,9 @@ function BasePhoneInput({ name, className = "", onChange, ...rest }: PhoneInputP
required: rest.required,
placeholder: rest.placeholder,
}}
onChange={(value) => onChange(value)}
onChange={(value) => {
onChange("+" + value);
}}
containerClass={classNames(
"hover:border-emphasis dark:focus:border-emphasis border-default !bg-default rounded-md border focus-within:outline-none focus-within:ring-2 focus-within:ring-brand-default disabled:cursor-not-allowed",
className
@ -63,7 +65,7 @@ const useDefaultCountry = () => {
retry: false,
onSuccess: (data) => {
if (isSupportedCountry(data?.countryCode)) {
setDefaultCountry(data.countryCode);
setDefaultCountry(data.countryCode.toLowerCase());
}
},
});