Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- validateSchema = (values: Object) => {
- try {
- this.props.validationSchema && this.props.validationSchema.validateSync(values, {abortEarly: false});
- return {};
- } catch (e) {
- return e.inner.reduce((errors, error) => {
- return setIn(errors, error.path, error.message);
- }, {});
- }
- };
- render() {
- const {initialValues, onSubmit, validateOnBlur, subscription, render, validationSchema, ...props} = this.props;
- const validate = validationSchema ? this.validateSchema : undefined;
- return (
- <FinalForm
- initialValues={initialValues}
- onSubmit={onSubmit}
- validate={validate}
- validateOnBlur={validateOnBlur}
- subscription={subscription}
- render={render}
- {...props}
- />
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement