import React, { useEffect, useId, useState } from 'react';
import Switch from 'react-switch';

export const SwitchField = ({ field, form, disabled }) => {
  const handleChange = (checked: boolean) => {
    form.setFieldValue(field.name, checked);
  };

  return (
    <Switch
      checkedIcon={false}
      uncheckedIcon={false}
      className={'check'}
      onChange={handleChange}
      checked={!!field?.value}
      disabled={disabled}
    />
  );
};
