@@ -15,8 +15,9 @@ export function Form({
15
15
onChange,
16
16
submitLabel,
17
17
validations,
18
+ transform,
18
19
} ) {
19
- const formState = useForm ( initialValues , validations , onChange ) ;
20
+ const formState = useForm ( initialValues , { validations, onChange, transform } ) ;
20
21
const formRef = useRef ( null ) ;
21
22
22
23
function resetForm ( ) {
@@ -69,17 +70,19 @@ Form.defaultProps = {
69
70
cancelLabel : 'Cancel' ,
70
71
customValidation : false ,
71
72
submitLabel : 'Submit' ,
73
+ transform : ( data ) => data ,
72
74
} ;
73
75
74
76
Form . propTypes = {
75
77
cancelLabel : PropTypes . string ,
76
78
children : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . arrayOf ( PropTypes . node ) ] ) ,
77
- customValidation : PropTypes . bool ,
78
79
customActions : PropTypes . oneOfType ( [ PropTypes . node , PropTypes . arrayOf ( PropTypes . node ) ] ) ,
80
+ customValidation : PropTypes . bool ,
79
81
initialValues : PropTypes . object ,
80
82
onCancel : PropTypes . func ,
81
- onSubmit : PropTypes . func . isRequired ,
82
83
onChange : PropTypes . func ,
84
+ onSubmit : PropTypes . func . isRequired ,
83
85
submitLabel : PropTypes . string ,
86
+ transform : PropTypes . func ,
84
87
validations : PropTypes . object ,
85
88
} ;
0 commit comments