2.1.1 • Published 9 months ago

natural-drag-animation-rbdnd v2.1.1

Weekly downloads
166
License
MIT
Repository
github
Last release
9 months ago

Info

Addon for the react-beautiful-dnd that adds natural dragging animation.

Demo

https://rokborf.github.io/natural-drag-animation-rbdnd/

Installation

# 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

Example

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>
  
...
      

Note

The component modifies styles from draggableProps, so style prop should be placed after {...provided.draggableProps} to override styles from it.

Props

snapshot (required)

Object. Pass snapshot from Draggable.

style (required)

Object. In most cases just pass provided.draggableProps.style from Draggable. NaturalDragAnimation patches transform from it.

animationRotationFade

Number. Use it to define fade speed of end rotation animation. Must be 0 < animationRotationFade < 1.

default = 0.9

rotationMultiplier

Number. Use it to define rotation multiplier.

default = 1.3

Compatibility

Version 2

Compatible with react-beautiful-dnd v.10+

Version 1

Compatible with react-beautiful-dnd v.9

Author

Dmytro Lytvynenko lytvynenko.dmytrij@gmail.com

License

MIT

Thanks

Nash Vail for his article

2.1.1

9 months ago

2.1.0

3 years ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

6 years ago