Skip to content

Commit

Permalink
Merge pull request #22 from ChizhovYuI/master
Browse files Browse the repository at this point in the history
call onValidationUpdated when get nextValidationStates
  • Loading branch information
tihonove authored Mar 22, 2018
2 parents dfbe447 + ce9418c commit d21c146
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Behaviour/ValidationWrapper.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ export default class ValidationWrapper extends React.Component<ValidationWrapper
}

syncWithState(props: ValidationWrapperProps) {
const nextValidationStates = props.validations.map(x => this.createState(x));
this.setState({
validationStates: props.validations.map(x => this.createState(x)),
validationStates: nextValidationStates,
});
const isValid = !nextValidationStates.find(x => x.visible);
this.context.validationContext.onValidationUpdated(this, isValid);
}

createState(validation: Validation): ValidationState {
Expand Down

0 comments on commit d21c146

Please sign in to comment.