Skip to main content

Submit

Submit component is a wrapper for your submit button. It is used to submit your form. It will handle the form submission and validations if validator prop is set.

Exampleโ€‹

import {Field} from 'react-swift-form';
import {Button} from 'react-native';

function MyForm() {
return (
<Submit onSubmit={(values) => console.log(values)}>
{({submit}) => (
<Button title="Submit" onPress={submit} />
)}
</Submit>
);
}

Propsโ€‹

onSubmitโ€‹

Required

A function that will be called when the form is submitted.

It will not be called if the any one of the validations fails.

TypeDefault
(values: Record<string, any>) => unknown;
Required

Children Propsโ€‹

These props are passed to the children.

submitโ€‹

Submits the form when called.

Type
() => void