Skip to content
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

Add startDrag and stopDrag callback function props #100

Open
wants to merge 2 commits into
base: rework
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@

startDrag: function (event, target, index) {
if (!this.moved) {
if (this.props.startDrag)
this.props.startDrag()

var rect = target.getBoundingClientRect();

var draggedStyle = {
Expand Down Expand Up @@ -577,6 +580,9 @@
// Stop dragging - reset style & draggedIndex, handle reorder
onWindowUp: function (event) {
clearTimeout(this.holdTimeout);

if (this.props.stopDrag)
this.props.stopDrag()

if (this.isDragging() && this.isDraggingFrom()) {
var fromIndex = this.state.draggedIndex;
Expand Down Expand Up @@ -780,7 +786,9 @@
autoScroll: PropTypes.bool,
autoScrollParents: PropTypes.bool,
disabled: PropTypes.bool,
disableContextMenus: PropTypes.bool
disableContextMenus: PropTypes.bool,
startDrag: PropTypes.func,
stopDrag: PropTypes.func
};

Reorder.defaultProps = {
Expand Down