Skip to content

Commit 8ffe7cf

Browse files
committed
Add "pendingFiles" and "uploadedFiles" to OnUpdate callback
1 parent c01a730 commit 8ffe7cf

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

MIGRATE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Steps:
88
2. Uninstall `react-uploader` and `uploader`
99
3. Replace `"react-uploader"` with `"@bytescale/upload-widget-react"` in your `import` statements.
1010
4. Replace `uploader` with `upload-widget` in all CSS class name overrides (if you have any).
11-
5. Remove `uploader` (from imports and props)
12-
6. Add `apiKey` as a field to the object passed to the `options` prop (add it if you don't have one).
11+
5. Replace `onUpdate: (files) => {}` with `onUpdate: ({uploadedFiles}) => {}`.
12+
6. Remove `uploader` (from imports and props)
13+
7. Add `apiKey` as a field to the object passed to the `options` prop (add it if you don't have one).
1314

1415
### Before
1516

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"react": ">=16.3.0"
7575
},
7676
"dependencies": {
77-
"@bytescale/upload-widget": "^4.9.0",
77+
"@bytescale/upload-widget": "^4.10.0",
7878
"lodash.isequal": "^4.5.0"
7979
},
8080
"devDependencies": {

src/UploadDropzone.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import React, { useLayoutEffect } from "react";
22
import { useElementRef } from "./hooks/UseElementRef";
33
import { useAutoUpdatingOptions } from "@bytescale/upload-widget-react/hooks/UseAutoUpdatingOptions";
44
import { UploadWidget, UploadWidgetConfig, UploadWidgetResult } from "@bytescale/upload-widget";
5+
import { UploadWidgetOnUpdateEvent } from "@bytescale/upload-widget/dist/config/UploadWidgetOnUpdateEvent";
56

67
interface Props {
78
className?: string;
89
height?: string;
910
minWidth?: string;
1011
onComplete?: (files: UploadWidgetResult[]) => void;
11-
onUpdate?: (files: UploadWidgetResult[]) => void;
12+
onUpdate?: (event: UploadWidgetOnUpdateEvent) => void;
1213
options: UploadWidgetConfig;
1314
width?: string;
1415
}

0 commit comments

Comments
 (0)