From 660a2a2dd390616dea07e97a5579d7ae2ffcddcd Mon Sep 17 00:00:00 2001 From: IceOnFire Date: Fri, 25 May 2018 11:13:48 +0200 Subject: [PATCH] Fix switch not updating on props change --- src/Switch.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Switch.js b/src/Switch.js index 7df81d54..a24f6e67 100644 --- a/src/Switch.js +++ b/src/Switch.js @@ -63,6 +63,14 @@ class AppSwitch extends Component { } } + componentDidUpdate(prevProps) { + if (this.props.checked !== prevProps.checked) { + this.setState({ + checked: this.props.checked + }) + } + } + render() { const { className, disabled, color, name, label, outline, size, required, type, value, dataOn, dataOff, variant, ...attributes } = this.props;