founderlab / react-dropzone-s3-uploader

Drag and drop s3 file uploader via react-dropzone + react-s3-uploader
MIT License
161 stars 82 forks source link

Passing onDrop prop ensures handleDrop method will not be called #40

Closed nolsto closed 7 years ago

nolsto commented 7 years ago

If DropzoneS3Uploader is given an onDrop callback, it will be present in the dropzoneProps const in the component's render method.

In render, when the Dropzone component is returned, it is given an onDrop property set to this.handleDrop, but then spreads the dropzoneProps, which will have an onDrop key. This means that onDrop={this.handleDrop} will always be replaced when the onDrop property exists.

This makes it strange that the handleDrop method checks the presence of and invokes this.props.onDrop.

Is the onDrop prop is supposed to fully replace handleDrop, or be called at the end of handleDrop? From my read on it, the latter can never happen.

nolsto commented 7 years ago

Just noticed the notDropzoneProps. Including the string "onDrop" in that array will prevent the problem.