Comments (7)
You could try adding event.stopPropagation() to the over dropTarget event, we can consider this as default behaviour for version 1.0
from react-dnd.
dropTarget: {
over(component, item, e) {
e.stopPropagation();
}
}
I have not had time to try my self however
from react-dnd.
OK, I'll try thanks a lot!
from react-dnd.
I don't think this will work. Drop state is determined by drop target type and enter/leave events.
Either way, it's not recommended to call stopPropagation
yourself. We will probably remove e
in future altogether because that exposes internal implementation and encourages dirty workarounds.
There are both cases when you want this nesting behavior and cases when you don't. Currently you can implement canDrop
on parent components and return false
if you know there's an active child handling them already. This will require manually telling parent that child is active from child's enter
and leave
events.
A better way would be to mirror what we do with acceptDrop
. It receives isHandled
which tells whether there is a child that already handled drop. Perhaps we should have a similar parameter for canDrop
: canDrop(component, item, isHandled)
. Parent components can then decide whether they want to activate if they know some child is already active.
from react-dnd.
ishandled inside candrop on my mind is the best solution
from react-dnd.
If you'd like to make a PR, go for it! We're a bit busy with large-scale refactoring so it's going to take some time to add this.
from react-dnd.
This issue is superseded by #87. I'll close it, please let's continue the discussion there!
from react-dnd.
Related Issues (20)
- dropEffect move doesn't work!
- react-dnd does not work on chrome android even with touch backend HOT 1
- Multiple select, then drag and drop HOT 2
- canDrop invoked permanently?
- Drag doesn't work after focusing password input
- Not working in parent with modal styling { top: 50%, left: 50%, transform: translate(-50%, -50%) } HOT 2
- Examples using React Class Components
- Preview is not working for the first drag HOT 2
- please keyboard functionality
- Preview Image only works once, on the first drag. HOT 3
- Uncaught Invariant Violation: Expected an existing source.
- Library breaks textareas, inputs etc. HOT 1
- table 拖拽时 使用最新版本的React-dnd Api时 出现node.addEventListener is not a function
- 拖动时useDrag无法访问组件内的变量 HOT 1
- @react-dnd/asap trigger swc error `env` and `jsc.target` cannot be used together
- Custom Drag Layer elements don't update until AFTER I drag it. HOT 1
- Redux v5
- Where is dropEffect coming from?
- Hello! I am kupraa from Indonesia, I am very excited to join the project and the communitystar_struck. Wish the project success and strong developmentheart
- [Question] Working with DnD and PrimeReact's DataTable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-dnd.