dispatch/client/src/js/components/ui/formik/Checkbox.js

26 lines
539 B
JavaScript
Raw Normal View History

2018-10-15 06:56:17 +00:00
import React from 'react';
import { Field } from 'formik';
import Checkbox from 'components/ui/Checkbox';
const FormikCheckbox = ({ name, onChange, ...props }) => (
<Field
name={name}
render={({ field, form }) => (
<Checkbox
name={name}
checked={field.value}
onChange={e => {
form.setFieldTouched(name, true);
field.onChange(e);
if (onChange) {
onChange(e);
}
}}
{...props}
/>
)}
/>
);
export default FormikCheckbox;