Open rvsia opened 4 years ago
The error occurred after updating React Final Form to 6.0.0
https://github.com/final-form/react-final-form/releases?after=v6.1.0
Current workaround until a fix in FF is released:
import { useEffect } from 'react';
import PropTypes from 'prop-types';
import useFormApi from '@data-driven-forms/react-form-renderer/dist/cjs/use-form-api';
const ValidatorReset = ({ name }) => {
const formOptions = useFormApi();
useEffect(() => {
setTimeout(() => formOptions.change(name, '1'));
return () => formOptions.change(name, '');
}, []);
return null;
};
ValidatorReset.propTypes = {
name: PropTypes.string.isRequired
};
export default ValidatorReset;
This component will set a value to 1
after it is mounted, so the form is re-rendered. On unMount value is set to undefined
. Be aware: when this component is on the last step, the value will stay in form values.
Scope: PF4 mapper
Description
Validating is set to true
Schema
cc @Hyperkid123