diff --git a/src/index.tsx b/src/index.tsx index e4126928..9920e199 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -296,8 +296,8 @@ export class Rnd extends React.PureComponent { } onDragStart(e: RndDragEvent, data: DraggableData) { - if (this.props.onDragStart) { - this.props.onDragStart(e, data); + if (this.props.onDragStart && this.props.onDragStart(e, data) === false) { + return false; } const pos = this.getDraggablePosition(); this.originalPosition = pos; @@ -385,6 +385,9 @@ export class Rnd extends React.PureComponent { dir: ResizeDirection, elementRef: HTMLElement, ) { + if (this.props.onResizeStart && this.props.onResizeStart(e, dir, elementRef) === false) { + return false; + } e.stopPropagation(); this.setState({ resizing: true, @@ -476,9 +479,6 @@ export class Rnd extends React.PureComponent { maxHeight: this.props.maxHeight, }); } - if (this.props.onResizeStart) { - this.props.onResizeStart(e, dir, elementRef); - } } onResize(