Skip to content
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

bug:change isDragReject true when maxFiles rejectDrag #1020

Merged
merged 11 commits into from Oct 28, 2020
2 changes: 1 addition & 1 deletion src/index.js
Expand Up @@ -751,7 +751,7 @@ export function useDropzone(options = {}) {
)

const fileCount = draggedFiles.length
const isDragAccept = fileCount > 0 && allFilesAccepted({ files: draggedFiles, accept, minSize, maxSize, multiple })
const isDragAccept = fileCount > 0 && allFilesAccepted({ files: draggedFiles, accept, minSize, maxSize, multiple,maxFiles })
morijenab marked this conversation as resolved.
Show resolved Hide resolved
const isDragReject = fileCount > 0 && !isDragAccept

return {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.js
Expand Up @@ -59,8 +59,8 @@ function isDefined(value) {
return value !== undefined && value !== null
}

export function allFilesAccepted({ files, accept, minSize, maxSize, multiple }) {
if (!multiple && files.length > 1) {
export function allFilesAccepted({ files, accept, minSize, maxSize, multiple,maxFiles }) {
if ((!multiple && files.length > 1) ||(multiple && maxFiles >= 1 && files.length > maxFiles) ) {
morijenab marked this conversation as resolved.
Show resolved Hide resolved
return false;
}

Expand Down