Merge branch 'error-schema-array' of git://github.com/knilink/react-jsonschema-form into knilink-error-schema-array

This commit is contained in:
Ethan Glasser-Camp
2018-01-26 18:27:59 -05:00
3 changed files with 65 additions and 17 deletions

View File

@@ -50,9 +50,16 @@ class ObjectField extends Component {
}
onPropertyChange = name => {
return (value, options) => {
return (value, errorSchema) => {
const newFormData = { ...this.props.formData, [name]: value };
this.props.onChange(newFormData, options);
this.props.onChange(
newFormData,
errorSchema &&
this.props.errorSchema && {
...this.props.errorSchema,
[name]: errorSchema,
}
);
};
};