New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show rejected styles when dragging multiple files and multiple==false #410
Changes from 1 commit
8e8be7c
602eb30
f0d3593
75e03cc
91b0373
b90171b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,11 +79,14 @@ class Dropzone extends React.Component { | |
this.dragTargets.push(e.target); | ||
} | ||
|
||
const allFilesAccepted = this.allFilesAccepted(getDataTransferItems(e, this.props.multiple)); | ||
// validate all files regardless if they are in multi file mode. | ||
const files = getDataTransferItems(e, true); | ||
const allFilesAccepted = this.allFilesAccepted(files); | ||
const isMultipleNotAllowed = this.props.multiple ? false : files.length > 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the negation with the new changes. |
||
|
||
this.setState({ | ||
isDragActive: allFilesAccepted, | ||
isDragReject: !allFilesAccepted | ||
isDragReject: !allFilesAccepted || isMultipleNotAllowed | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what this means exactly. I just pushed a change so let me know if I need to update it. |
||
}); | ||
|
||
if (this.props.onDragEnter) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true
is default argument, so you can skip it