);
};
FormNestedItem.contextTypes = {
errors: PropTypes.array,
};
registerComponent('FormNestedItem', FormNestedItem);
class FormNested extends PureComponent {
addItem = () => {
this.props.updateCurrentValues({ [`${this.props.path}.${this.props.value.length}`]: {} });
};
removeItem = index => {
this.props.updateCurrentValues({ [`${this.props.path}.${index}`]: null });
};
/*
Go through this.context.deletedValues and see if any value matches both the current field
and the given index (ex: if we want to know if the second address is deleted, we
look for the presence of 'addresses.1')
*/
isDeleted = index => {
return this.context.deletedValues.includes(`${this.props.path}.${index}`);
};
render() {
const { value, ...rest } = this.props;
return (