Skip to content

Commit

Permalink
Fix switch not updating on props change
Browse files Browse the repository at this point in the history
  • Loading branch information
IceOnFire committed May 25, 2018
1 parent 8420c2f commit 660a2a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 660a2a2

Please sign in to comment.