fix: lint
This commit is contained in:
@@ -41,21 +41,18 @@ export default function Phone({
|
||||
rules: registerOptions,
|
||||
})
|
||||
|
||||
const handleCountrySelectForPhone = useCallback(
|
||||
(country: string) => {
|
||||
const selectedCountry = getCountry({
|
||||
countries: defaultCountries,
|
||||
field: "iso2",
|
||||
value: country.toLowerCase(),
|
||||
})
|
||||
const handleCountrySelectForPhone = useCallback((country: string) => {
|
||||
const selectedCountry = getCountry({
|
||||
countries: defaultCountries,
|
||||
field: "iso2",
|
||||
value: country.toLowerCase(),
|
||||
})
|
||||
|
||||
if (selectedCountry) {
|
||||
phoneRef.current?.setCountry(selectedCountry.iso2)
|
||||
prevSelectedCountry.current = country.toLowerCase()
|
||||
}
|
||||
},
|
||||
[phoneRef.current, prevSelectedCountry.current]
|
||||
)
|
||||
if (selectedCountry) {
|
||||
phoneRef.current?.setCountry(selectedCountry.iso2)
|
||||
prevSelectedCountry.current = country.toLowerCase()
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (countryValue) {
|
||||
@@ -80,7 +77,7 @@ export default function Phone({
|
||||
handleCountrySelectForPhone(countryValue)
|
||||
}
|
||||
}
|
||||
}, [countryValue, prevSelectedCountry.current])
|
||||
}, [countryValue, field.value, handleCountrySelectForPhone])
|
||||
|
||||
return (
|
||||
<div className={styles.phone}>
|
||||
|
||||
Reference in New Issue
Block a user