Open jvmanke opened 4 years ago
@jvmanke As far as I know this is not part of the package.
There's an article on how to achieve it with fluid dragging: https://dev.to/raathigesh/scripted-natural-motion-with-react-beautiful-dnd-4ifj
Same here. The animation is canceled when drop() is used. But if I omit drop() the animation is being executed (but lock is not released). fluid dragging with tweens like in the article works.
@jvmanke @MonkeyPanic Have any of you guys made it work? I am on the same boat and I am hitting a wall.
Hello, I am trying to programmatically apply changes coming from my backend to a dnd controlled list.
Letting the data update freely causes my cards to instantly switch places (expected), however I would like the animations of cards changing places to happen.
What I thought of doing was to write a sensor that, before applying the changes to my droppable array, move each to the right place. I used the story as an example, but realized that when in succession doing, for example,
actions.moveRight(); actions.drop();
, the droppable is translated instantly to the new place instead of animating.Expected behavior
Droppable animates to the position, and then is dropped.
Actual behavior
Droppable is moved and dropped instantly.
Steps to reproduce
Add the following sensor to a DragDropContext and call moveDown(someId) in the console:
What version of
React
are you using?16.13.1
What version of
react-beautiful-dnd
are you running?13.0.0
What browser are you using?
Google Chrome - Version 84.0.4147.105 (Official Build) (64-bit)
Demo
Run
moveDown("item-1")
on the sandbox console,moveDownDelay("item-1")
shows that the animation happens, but is canceled by thedrop
frunction:https://codesandbox.io/s/vertical-list-3wx8r