Skip to content

Commit

Permalink
Merge pull request #12 from IngloriousCoderz/master
Browse files Browse the repository at this point in the history
Fix switch not updating on props change
  • Loading branch information
xidedix authored Jun 14, 2018
2 parents 6aec9d8 + 660a2a2 commit 58fed10
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 58fed10

Please sign in to comment.