Update libphonenumber-js
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
"use client"
|
||||
import "react-international-phone/style.css"
|
||||
|
||||
import { isValidPhoneNumber, parsePhoneNumber } from "libphonenumber-js"
|
||||
import {
|
||||
isValidPhoneNumber,
|
||||
parsePhoneNumberWithError,
|
||||
} from "libphonenumber-js"
|
||||
import { TextField } from "react-aria-components"
|
||||
import { useController, useFormContext, useWatch } from "react-hook-form"
|
||||
import {
|
||||
@@ -59,7 +62,7 @@ export default function Phone({
|
||||
// If defaultPhoneNumber exists and is valid, parse it to get the country code,
|
||||
// otherwise set the default country from the lang.
|
||||
const defaultCountry = isValidPhoneNumber(defaultPhoneNumber)
|
||||
? parsePhoneNumber(defaultPhoneNumber).country?.toLowerCase()
|
||||
? parsePhoneNumberWithError(defaultPhoneNumber).country?.toLowerCase()
|
||||
: getDefaultCountryFromLang(lang)
|
||||
|
||||
const { country, handlePhoneValueChange, inputValue, setCountry } =
|
||||
|
||||
Reference in New Issue
Block a user