DEV Community

Discussion on: Using React Hook Form v6+ with Ionic React Components - Update

Collapse
 
aaronksaunders profile image
Aaron K Saunders • Edited

Saw this issue on Stackoverflow, stackoverflow.com/questions/630772...

here is a workaround

You can just add the interface...

export interface CheckboxChangeEventDetail {
  value: any;
  checked: boolean;
}
Enter fullscreen mode Exit fullscreen mode

and then set the code

<IonItem>
  <Controller
    render={({ onChange, onBlur }) => (
      <IonCheckbox
        onIonChange={(e: CustomEvent<CheckboxChangeEventDetail>) => {
          onChange(e?.detail.checked);
          console.log(e);
        }}
        onIonBlur={onBlur}
      />
    )}
    control={control}
    defaultValue={false}
    name="saveInfo"
    rules={{
      required: false,
    }}
  />
</IonItem>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
curiouswebs profile image
curious-webs

Tried using interface for email field But still getting "Property 'onChange' does not exist on type"
in here
render={({ onChange, onBlur, value }) => (