Reactjs 如何停止受控输入的光标跳跃
我目前使用react-phone-input-2作为Formik字段,但我尝试编辑光标跳到末尾的电话号码。这是我的手机部件Reactjs 如何停止受控输入的光标跳跃,reactjs,input,Reactjs,Input,我目前使用react-phone-input-2作为Formik字段,但我尝试编辑光标跳到末尾的电话号码。这是我的手机部件 const Telephone = (props) => { const { form = {}, ...others } = props; const { setTouched, setFieldValue } = form; return <PhoneInput specialLabel='' enableSearch
const Telephone = (props) => {
const { form = {}, ...others } = props;
const { setTouched, setFieldValue } = form;
return <PhoneInput
specialLabel=''
enableSearch
searchNotFound=""
localization={fr}
onBlur={() => setTouched && setTouched({ [name]: true })}
onChange={val => setFieldValue(name, val)}
isValid={!error}
value={field.value}
preferredCountries={['fr']}
{...props}
/>
const电话=(道具)=>{
const{form={},…others}=props;
const{setTouched,setFieldValue}=form;
返回setTouched&&setTouched({[name]:true})}
onChange={val=>setFieldValue(name,val)}
isValid={!error}
value={field.value}
首选国家={['fr']}
{…道具}
/>
如果有人在这个问题上苦苦挣扎并解决了它,如果你能与我分享你的解决方案,我将不胜感激