diff --git a/README.md b/README.md index d3b130a..666e7ab 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Render prop gives you access to three callbacks: | Prop | Type | Description | | :------------------ | :-------------------------------------- | :---------------------------------- | `browseFiles` | `BrowseFilesParams => void` | Once executed, file browser will be shown. Useful for file upload buttons. The callback can also accept custom `onSuccess` and `onError` callbacks, that will override the main ones. | -| `validate` | `(files: Array) => void` | Enables manual validation of files. Eg. after editing the selected image in an image editor. | +| `validate` | `(files: Array) => Array` | Enables manual validation of files. Eg. after editing the selected image in an image editor. | | `getDropZoneProps` | `(additionalProps: ?Object) => Object` | Props that need to be spread to a drop zone. Additional props can be passed, for example `className` or `style`. | | `getLabelProps` | `(additionalProps: ?Object) => Object` | Props that need to be spread to your file field's label. Additional props can be passed, for example `className` or `style`. | diff --git a/src/Files.js b/src/Files.js index 7a47ff5..693f51e 100644 --- a/src/Files.js +++ b/src/Files.js @@ -23,7 +23,7 @@ export type FileError = { | "multipleMaxSizeExceeded" | "multipleMaxCountExceeded" | "multipleNotAllowed", - file?: SelectedFile + file?: SelectedFile | File }; export type BrowseFilesParams = { @@ -73,7 +73,7 @@ class Files extends React.Component { this.id = generateId(); } - validateFiles(files: Array): Array { + validateFiles(files: Array | Array): Array { const { multiple, multipleMaxSize, multipleMaxCount, accept, maxSize } = this.props; const errors: Array = [];