react-split-pane
react-split-pane copied to clipboard
Pass event to onChange, onDragStarted, and onDragFinished handlers
onChange and onDragFinished only receive the size of the primary pane.
onDragStarted receives nothing.
I have a use case where the DOM element that contains the SplitPane is draggable. If the user starts a drag on the resizer, though, it should be locked. It would be helpful to simply prevent propagation of the event from the onDragStarted handler.
It could be added as the second argument to prevent a breaking change.
I was about to open the same issue. I'm aware that there's a V2 in progress and this might not be a priority, but I've created a PR to address this issue https://github.com/tomkp/react-split-pane/pull/351 @tomkp - You think you'll be able to have a look?
For the time being - here's a quick fix:
function handleMouseDown(evt) {
const isResizer = evt.target.classList.contains('Resizer');
if (isResizer) {
evt.stopPropagation();
}
}
<div onMouseDown={handleMouseDown}>
<Draggable...
<SplitPane...
</Draggable>
</div>