From ccfb1f116b8fb40ec5a075472dd760baa99be878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olle=20Br=C3=B6ms?= Date: Mon, 24 Sep 2018 15:23:37 +0200 Subject: [PATCH] Fix that colorpicker shows up on click --- addons/knobs/src/components/types/Color.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/knobs/src/components/types/Color.js b/addons/knobs/src/components/types/Color.js index ed7b82d284fc..ad4f808d6380 100644 --- a/addons/knobs/src/components/types/Color.js +++ b/addons/knobs/src/components/types/Color.js @@ -28,10 +28,13 @@ class ColorType extends React.Component { document.addEventListener('mousedown', this.handleWindowMouseDown); } - shouldComponentUpdate(nextProps) { + shouldComponentUpdate(nextProps, nextState) { const { knob } = this.props; + const { displayColorPicker } = this.state; - return nextProps.knob.value !== knob.value; + return ( + nextProps.knob.value !== knob.value || nextState.displayColorPicker !== displayColorPicker + ); } componentWillUnmount() {