From a7f9485dd80482d22d6c0c2e8b71d3be6fa4065d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Aug 2019 17:25:13 -0500 Subject: [PATCH 1/2] Added startDrag and stopDrag callback props --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index b9cc050b..df82d508 100644 --- a/src/index.js +++ b/src/index.js @@ -520,6 +520,7 @@ startDrag: function (event, target, index) { if (!this.moved) { + this.props.startDrag() var rect = target.getBoundingClientRect(); var draggedStyle = { @@ -577,6 +578,8 @@ // Stop dragging - reset style & draggedIndex, handle reorder onWindowUp: function (event) { clearTimeout(this.holdTimeout); + + this.props.stopDrag() if (this.isDragging() && this.isDraggingFrom()) { var fromIndex = this.state.draggedIndex; @@ -780,7 +783,9 @@ autoScroll: PropTypes.bool, autoScrollParents: PropTypes.bool, disabled: PropTypes.bool, - disableContextMenus: PropTypes.bool + disableContextMenus: PropTypes.bool, + startDrag: PropTypes.func, + stopDrag: PropTypes.func }; Reorder.defaultProps = { From a8873d5c3c27be462baf733d44e6ddc209f2a2e4 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 19 Aug 2019 17:28:53 -0500 Subject: [PATCH 2/2] Fixed it --- src/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index df82d508..902a1a24 100644 --- a/src/index.js +++ b/src/index.js @@ -520,7 +520,9 @@ startDrag: function (event, target, index) { if (!this.moved) { - this.props.startDrag() + if (this.props.startDrag) + this.props.startDrag() + var rect = target.getBoundingClientRect(); var draggedStyle = { @@ -579,7 +581,8 @@ onWindowUp: function (event) { clearTimeout(this.holdTimeout); - this.props.stopDrag() + if (this.props.stopDrag) + this.props.stopDrag() if (this.isDragging() && this.isDraggingFrom()) { var fromIndex = this.state.draggedIndex;