From b1bb816d20540826dd9ca0882ca9562bcec2a058 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 25 Jan 2021 14:18:10 -0800 Subject: [PATCH 1/2] add enabled --- src/ResizePanel.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ResizePanel.js b/src/ResizePanel.js index 12f16ad..45a2f6b 100644 --- a/src/ResizePanel.js +++ b/src/ResizePanel.js @@ -76,7 +76,11 @@ class ResizePanel extends React.Component { } handleDrag = (e, ui) => { - const { direction } = this.props; + const { direction, enabled } = this.props; + if (!enabled) { + return; + } + const factor = direction === "e" || direction === "s" ? -1 : 1; // modify the size based on the drag delta @@ -85,6 +89,9 @@ class ResizePanel extends React.Component { }; handleDragEnd = (e, ui) => { + if (!this.props.enabled) { + return; + } this.validateSize(); }; From c099a1b7c995f99853da4553976a3e0d6bd9ab67 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 25 Jan 2021 14:22:14 -0800 Subject: [PATCH 2/2] add enabled --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 75cb8c1..5277460 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,14 @@ Custom CSS classes can be specified for the resize handle and border: ``` +The enabled prop will toggle the drag on and off + +```js + +
left panel
+
+``` + ## Notes Tests on all modern browsers performed via BrowserStack.