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

25 lines
513 B
JavaScript
Raw Normal View History

import React, { memo } from 'react';
import { FastField } from 'formik';
2018-10-15 06:56:17 +00:00
import Checkbox from 'components/ui/Checkbox';
const FormikCheckbox = ({ name, onChange, ...props }) => (
<FastField
2018-10-15 06:56:17 +00:00
name={name}
2018-12-19 01:55:50 +00:00
render={({ field }) => (
<Checkbox
name={name}
checked={field.value}
onChange={e => {
field.onChange(e);
if (onChange) {
onChange(e);
}
}}
{...props}
/>
)}
2018-10-15 06:56:17 +00:00
/>
);
export default memo(FormikCheckbox);