Skip to content

Commit

Permalink
fix: make FormikCheck useField like other fields
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleyboar committed May 20, 2024
1 parent d005466 commit 9205e39
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FieldInputProps, Field } from 'formik';
import { FieldInputProps, Field, useField } from 'formik';
import { FormikInputProps } from '.';
import { Input, FormText, FormGroup, Label } from 'reactstrap';
import styles from './FormikCheck.module.css';
Expand All @@ -10,6 +10,7 @@ const FormikCheck: React.FC<FormikInputProps> = ({
description,
...props
}: FormikInputProps) => {
const [field] = useField(name);
return (
<FormGroup check>
<Label check className={`form-field__label ${styles.nospace}`} size="sm">
Expand All @@ -18,6 +19,7 @@ const FormikCheck: React.FC<FormikInputProps> = ({
as={(formikProps: FieldInputProps<any>) => (
<Input
bsSize="sm"
{...field}
{...props}
{...formikProps}
type="checkbox"
Expand Down

0 comments on commit 9205e39

Please sign in to comment.