it is possible that you set up a Field value, solution that does not exist originally, or add input to hidden to see the official issues
to see setFieldsValue ({.params}), the assigned variable (params), whether there are any variables registered in getFieldDecorator (param).
this.props.form.setFields
can only be used in lifecycle functions after render, because fields is registered in the render function
processing in render
render() {
const {getFieldProps} = this.props.form;
return (
<List>
<InputItem {...getFieldProps('username')}/>
<InputItem {...getFieldProps('password')}/>
</List>
);
}
If
is not in render, you usually set it manually in componentDidMount
.
this.props.form.setFieldsValue({
username:'xxx',
password:'xxx'
})
I also reported this error today, and finally found that destroyOnClose= {true} was set in the Modal box, causing the error!
I also encountered this problem today. My problem is that the note used in
this.props.form.setFieldsValue ({note: msg})
in the lifecycle method componentDidMount is not registered with getFieldDecorator, so if an error is reported, just change the getFieldDecorator to note.
<FormItem {...formItemLayout} label="">
{getFieldDecorator('note', {
rules: [
{
required: getFieldValue('reasonable') === 'reasonable' ? true : false,
},
],
})(
<Input/>
)}
</FormItem>