-
Notifications
You must be signed in to change notification settings - Fork 2k
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
DropTarget that accepts all types #432
Comments
I'm not an expert, but as far as I know, this isn't possible. Even if you get the // YourComponents.js
- import { DragSource } from "react-dnd";
+ import { DragSource } from "./DragSource"; // DragSource.js
import { DragSource as ReactDnDDragSource } from "react-dnd";
var types = new Set();
export function DragSource(type, ...args) {
types.add(type); // hopefully you're not using (props) => type
return ReactDnDDragSource(type, ...args);
}
export function allTypes() {
return Array.from(types);
} |
I'm wondering if it would be better to modify |
Yeah I think that would be the right solution! |
Cool! |
Yep, |
Cool, I'll finish this up then. |
@simshaun since we have canDrop() would you please see if this issue is still valid? |
Sorry, it's been so long I don't remember what codebase I was working in. Looking at the docs, I'm not sure if |
@simshaun you can have type = ["common"] (or all types) on DropTarget so any source can be dropped on that target. Now if canDrop() is available DnD will use it for all sources. So you can precisely control what source can be dropped and when. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Looking at the docs, it doesn't seem so. So is there any solution to that problem? I don't understand @crispy-invention suggestion. |
accept is mandatory. |
I'm trying to globally implement window scrolling when any DragSource is dragged close to the window's edge.
Going off of http://gaearon.github.io/react-dnd/examples-sortable-stress.html, I'm making my entire App a DropTarget whose sole purpose is to handle scrolling via the
hover
specification method.What I can't figure out is how to have that DropTarget accept any type. I don't want to have to explicitly list/register every possible type at the App root. Is that currently possible? or am I going about it all wrong?
The text was updated successfully, but these errors were encountered: