Upload.Dragger 和 react-dnd-html5-backend 共用时,拖动文件上传失效

Open Beginner friendly
#170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start in src/AjaxUploader.jsx at lines 64-68, especially the onFileDrop entry point, and reproduce the failure with Upload.Dragger used alongside react-dnd-html5-backend. Compare the reported stopPropagation workaround with the wrapper workaround, then verify that dragging files still uploads correctly when both components are used together.

Written by the indexing model from the issue text.

Description

my solution:
https://github.com/react-component/upload/blob/e0c50a096054fafd24c3c14b250576f25e968c88/src/AjaxUploader.jsx#L64-L68
add: e.stopPropagation()

onFileDrop = e => { 
   e.stopPropagation();
   e.preventDefault();

or add a wrapper:

<div onDrop={e => e.stopPropagation()}>
  <Upload.Dragger {...props}>...</Upload.Dragger>
</div>
Dominant language
TypeScript
Stars
804
Forks
323
Avg merge
12m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-component/upload

All issues in react-component/upload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.