react-phone-input-2
react-phone-input-2 copied to clipboard
Placeholder value is ignored if country is used
It would be better if placeholder is still visible next to country code
+1
+1
+1
Hi folks, try this:
const [value, setValue]= useState('')
// ...
useEffect(() => {
// tricky way of set as empty the phoneInput with a country code selected
let timer = setTimeout(() => setValue('1'), 100) // or whatever state you have, Formik, RHF...
let timer2 = setTimeout(() => setValue(''), 200)
return () => {
clearTimeout(timer)
clearTimeout(timer2)
}
}, [])
// ... add value to your PhoneInput component like always...
Voilà, it works 😉
Hi folks, try this:
const [value, setValue]= useState('') // ... useEffect(() => { // tricky way of set as empty the phoneInput with a country code selected let timer = setTimeout(() => setValue('1'), 100) // or whatever state you have, Formik, RHF... let timer2 = setTimeout(() => setValue(''), 200) return () => { clearTimeout(timer) clearTimeout(timer2) } }, []) // ... add value to your PhoneInput component like always...
Voilà, it works 😉
dont work)