form icon indicating copy to clipboard operation
form copied to clipboard

can't get fields value in onValuesChange callback when native input.

Open senwong opened this issue 4 years ago • 0 comments

codesandbox demo

I want use form.getFieldsValue function in onValuesChange callback. But When typing in the input element,form.getFieldsValue can not get the value. image

But when changing field value by form.setFieldsValue function, in onValuesChange callback can get field value. Is this by design? image

In createBaseForm.js in this.setFieldsValue function, onValuesChange callback is invoked after this.setFields. https://github.com/react-component/form/blob/f02b478c59c178ea9ee28cca3326ad1c4ed37f02/src/createBaseForm.js#L370 image

But in this.onCollect function, onValuesChange callback is invoked before this.setFields. Is this by design? https://github.com/react-component/form/blob/f02b478c59c178ea9ee28cca3326ad1c4ed37f02/src/createBaseForm.js#L133 image

senwong avatar Jul 13 '21 01:07 senwong