From 575fa059053038b08e5f338101e815d77b1ec512 Mon Sep 17 00:00:00 2001 From: Lin Date: Thu, 20 Apr 2017 13:03:47 +0800 Subject: [PATCH] Disable resize if is uncontrolled. --- src/Dock.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Dock.js b/src/Dock.js index 2d6ef24..27d79d2 100644 --- a/src/Dock.js +++ b/src/Dock.js @@ -315,7 +315,7 @@ export default class Dock extends Component { } render() { - const { children, zIndex, dimMode, position, isVisible } = this.props; + const { children, zIndex, dimMode, position, isVisible, isControlled } = this.props; const { isResizing, size, isDimHidden } = this.state; const dimStyles = Object.assign({}, ...getDimStyles(this.props, this.state)); @@ -328,8 +328,9 @@ export default class Dock extends Component {
}
-
+ {isControlled && +
+ }
{typeof children === 'function' ? children({ @@ -426,7 +427,7 @@ export default class Dock extends Component { this.props.onSizeChange && this.props.onSizeChange(size); - if (!isControlled) { + if (isControlled) { this.setState({ size }); } }