我正在使用
react-textarea-autosize
和
formik
我想知道如何正确地将formik的更改事件挂接到textraeaautosize?
<Formik
initialValues={{
description: ''
}}
validationSchema={Yup.object().shape({
})}
onSubmit={(values, { setSubmitting, setErrors }) => {
console.log('v', values)
}}
render={props => (
<Form autoComplete="off">
<div className="field">
<label className="label">Description</label>
<div className="control">
<TextareaAutosize
className="input"
onChange={props.handleChange}
onBlur={props.handleBlur}
name="description"
value={props.values.description}
/>
</div>
</div>
</Form>
)}
所以当我做一个onSubmit时,我确实看到了在textarea中输入的数据,但是当我在textarea中做一个“enter”时,我得到了这些错误
onloadwff.js:71 Assertion failed: Input argument is not an HTMLInputElement
getFormProfile @ onloadwff.js:71
setFieldValue @ onloadwff.js:71
formKeydownListener @ onloadwff.js:71
onloadwff.js:71 Uncaught TypeError: Cannot read property 'type' of undefined
at e.setFieldValue (onloadwff.js:71)
at HTMLFormElement.formKeydownListener (onloadwff.js:71)
setFieldValue @ onloadwff.js:71
formKeydownListener @ onloadwff.js:71