react-smooth-dnd icon indicating copy to clipboard operation
react-smooth-dnd copied to clipboard

ShouldAcceptDrop causing field to copy instead of move

Open meganburtenshaw opened this issue 6 years ago • 2 comments

I have a horizontal container that I'm trying to limit the number of objects it can contain to 4. When the container has 4 items, if I try to move an object out of the container, the card copies itself instead of move (even though the obj behaviour says "move"). The card only copies when there are 4 items. Behaviour is normal with 3 or less in the container.

shouldAcceptDrop(containerIndex, obj) { console.log(obj); let length = this.state.scene.card_container[containerIndex].cards.length;

if (length >= 4) { return false; } else { return true; } }

the console log returns this: animationDuration: 250 autoScrollEnabled: true behaviour: "move" children: (4) [{…}, {…}, {…}, {…}] dragClass: "card-ghost" dragHandleSelector: ".column-drag-handle" getChildPayload: ƒ () groupName: "1" onDrop: ƒ () orientation: "horizontal" shouldAcceptDrop: ƒ () shouldAnimateDrop: null proto: Object

meganburtenshaw avatar Apr 11 '19 13:04 meganburtenshaw

I have a similar problem with ShouldAcceptDrop.

yosbell avatar Oct 25 '19 14:10 yosbell

@meganburtenshaw did you get the solution of your problem? Also, I need the limited number of objects in horizontal drag and drop. If you already got this solution, please let me know.

Thanks.

dev-assassin avatar Jun 25 '20 11:06 dev-assassin