From b1019d6babd86b4f36ebf8f2cb5e698658169624 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Thu, 1 Jun 2023 15:17:18 +0530 Subject: [PATCH] fix: [Hotfix]No phone number is valid (#9258) * Fix invalid phone number always * Fix countrycode detection --- packages/ui/form/PhoneInput.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ui/form/PhoneInput.tsx b/packages/ui/form/PhoneInput.tsx index 91656f576a..59466430b6 100644 --- a/packages/ui/form/PhoneInput.tsx +++ b/packages/ui/form/PhoneInput.tsx @@ -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()); } }, });