Skip to content

Commit

Permalink
fix types (#2131)
Browse files Browse the repository at this point in the history
  • Loading branch information
FSM1 authored May 16, 2022
1 parent 5990c02 commit d548001
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { useField } from "formik"
import CheckboxInput from "./CheckboxInput"

interface IFormikCheckboxProps
extends Omit<React.HTMLProps<HTMLInputElement>, "label"> {
extends Omit<React.HTMLProps<HTMLInputElement>, "label" | "onClick"> {
className?: string
name: string
label?: string | ReactNode
onClick?: (event: React.MouseEvent) => void
}

const FormikCheckboxInput: React.FC<IFormikCheckboxProps> = ({ name, onChange, ...props }) => {
const FormikCheckboxInput: React.FC<IFormikCheckboxProps> = ({ name, onChange, onClick, ...props }) => {
const [field, meta, helpers] = useField<boolean>(name)

const handleChange = (event: React.FormEvent<HTMLInputElement>) => {
Expand All @@ -20,6 +21,7 @@ const FormikCheckboxInput: React.FC<IFormikCheckboxProps> = ({ name, onChange, .
return (
<CheckboxInput
onChange={handleChange}
onClick={onClick}
error={meta.touched ? meta.error : undefined}
{...props}
value={field.value}
Expand Down

0 comments on commit d548001

Please sign in to comment.