react-dropzone v11.0.0 Release Notes

Release Date: 2020-04-26 // almost 4 years ago
  • 11.0.0 (2020-04-26)

    ๐Ÿ”‹ Features

    • โž• add reject reasons to onDrop, onDropRejected callbacks (#938) (199c9ea)

    ๐Ÿ’ฅ BREAKING CHANGES

    • The method signatures of onDrop and onDropRejected as well as the return value of useDropzone were changed in order to add the reasons why rejected files were rejected.

    onDrop BEFORE this change:

    onDrop?<T extends File>(acceptedFiles: T[], rejectedFiles: T[], event: DropEvent): void;
    

    onDrop AFTER this change:

    onDrop?<T extends File>(acceptedFiles: T[], fileRejections: FileRejection[], event: DropEvent): void;
    

    onDropRejected BEFORE this change:

    onDropRejected?<T extends File>(files: T[], event: DropEvent): void;
    

    onDropRejected AFTER this change:

    onDropRejected?(fileRejections: FileRejection[], event: DropEvent): void;
    

    rejectedFiles from the return value of useDropzone was replaced with
    fileRejections.

    The defintion of a FileRejection is:

    export interface FileError {
      message: string;
      code: string;
    }
    
    export interface FileRejection {
      file: File;
      errors: FileError[];
    }