viclafouch / mui-file-input

A file input designed for the React library MUI
https://viclafouch.github.io/mui-file-input/
MIT License
77 stars 17 forks source link

React hook form bug if MuiFileInput is required #7

Closed TanguyRiou closed 1 year ago

TanguyRiou commented 1 year ago

Describe the bug Within a react hook form if the MuiFileInput is required the validation does not work

To Reproduce Steps to reproduce the behavior: <Controller rules={{ required: true }} control={control} name={"consumptionFile"} render={({ field }) => ( <MuiFileInput required {...field} /> )} />

The form can't be submitted even when a file was set.

Screenshots image

viclafouch commented 1 year ago

Hello !

Can you share a codesandbox plz ?