fris-fruitig/react-firebase-file-uploader

Manual Download Example not working

Opened this issue · 0 comments

Hi,

first of all thank you for this nice package. I just wanted to report a small bug in your example that cost me some time to find. In order to spare other people from this I want to provide the fix.

In the last Section "Starting downloads manually"
customOnChangeHandler = (event) => { const { target: { files } } = event; const filesToStore = []; files.forEach(file => filesToStore.push(file)); this.setState({ files: filesToStore }); }

Line 298: files.forEach(file => filesToStore.push(file)) does not work because files is an object of objects which cannot use forEach.
Replace this line with

Object.values(files).map((file) => filesToStore.push(file));
and everything works as expected.

Best regards
Marty

Edit: Not sure how linebreak works in a codeblock. Two spaces are not working.