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
Change API to make configureDragDrop static #54
Milestone
Comments
To clarify. Before: var Card = React.createClass({
mixins: [DragDropMixin],
configureDragDrop(registerType) {
registerType(ItemTypes.CARD, {
dragSource: {
beginDrag() {
return {
item: {
id: this.props.id,
children: <Card {...this.props}/>
}
};
}
},
dropTarget: {
over(item) {
this.props.moveCard(item.id, this.props.id);
}
}
});
}, After: var Card = React.createClass({
mixins: [DragDropMixin],
statics: {
configureDragDrop(registerType) {
registerType(ItemTypes.CARD, {
dragSource: {
beginDrag(component) {
return {
item: {
id: component.props.id,
children: <Card {...component.props}/>
}
};
}
},
dropTarget: {
over(component, item) {
component.props.moveCard(item.id, component.props.id);
}
}
});
}
} We may want to have a less nested API later, but this is not the point. The point is using This breaks the use case when |
nelix
pushed a commit
to nelix/react-dnd
that referenced
this issue
Feb 8, 2015
nelix
pushed a commit
to nelix/react-dnd
that referenced
this issue
Feb 10, 2015
nelix
pushed a commit
to nelix/react-dnd
that referenced
this issue
Feb 10, 2015
Released in |
kkga
pushed a commit
that referenced
this issue
Apr 21, 2015
Added passing width to groupHeaders and fixed some props of it
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I propose we make
configureDragDrop
static, and pass currentcomponent
as the first argument to each method. This change is a stepping stone to fixendDrag
not firing on unmounted component (#38, we'll passnull
ascomponent
) and also a stepping stone to allow “resurfacing” drag sources (#53, we'll pass another component ascomponent
).I'd like this change to be implemented in a backward-compatible way with a deprecation warning. We will make it a breaking change in 1.0 with #48.
configureDragDrop
and passcomponent
as the first argument to all methodsconfigureDragDrop
definitions (withoutcomponent
parameter)1.0
branch.Any comments or volunteers?
@hakanderyal @nelix
The text was updated successfully, but these errors were encountered: