Addon for the react-beautiful-dnd that adds natural dragging animation.
https://rokborf.github.io/natural-drag-animation-rbdnd/
# yarn
yarn add natural-drag-animation-rbdnd
# npm
npm install natural-drag-animation-rbdnd
If you're using typescript in your project, you might as well want to install the types.
npm i @types/natural-drag-animation-rbdnd
import NaturalDragAnimation from 'natural-drag-animation-rbdnd';
...
<Draggable>
{(provided, snapshot) => (
<NaturalDragAnimation
style={provided.draggableProps.style}
snapshot={snapshot}
>
{style => (
<div
ref={provided.innerRef}
{...provided.draggableProps}
{...provided.dragHandleProps}
style={style}
>
Item content
</div>
)}
</NaturalDragAnimation>
)}
</Draggable>
...
The component modifies styles from draggableProps
, so style
prop should be placed after {...provided.draggableProps}
to override styles from it.
Object. Pass snapshot
from Draggable
.
Object. In most cases just pass provided.draggableProps.style
from Draggable
. NaturalDragAnimation
patches transform
from it.
Number. Use it to define fade speed of end rotation animation. Must be 0 < animationRotationFade
< 1.
default = 0.9
Number. Use it to define rotation multiplier.
default = 1.3
Compatible with react-beautiful-dnd v.10+
Compatible with react-beautiful-dnd v.9
Dmytro Lytvynenko lytvynenko.dmytrij@gmail.com
MIT
Nash Vail for his article