fris-fruitig / react-firebase-file-uploader

An image uploader for react that uploads images to your firebase storage
https://npm.im/react-firebase-file-uploader
166 stars 45 forks source link

Manual Download Example not working #44

Open martykuentzel opened 4 years ago

martykuentzel commented 4 years ago

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.