Skip to content

Commit

Permalink
Fixed value update on slider (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cromefire_ authored Sep 30, 2018
2 parents 649c343 + 5851474 commit cd2111d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ts/Switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ export class Switch extends MaterialComponent<ISwitchProps, ISwitchState> {
super.componentDidMount();
if (this.control) {
this.MDComponent = new MDCSwitch(this.control);
if (this.props.value) {
this.MDComponent.value = this.props.value;
}
}
}

public componentWillUpdate(nextProps: ISwitchProps) {
if (nextProps.value && this.props.value !== nextProps.value) {
this.MDComponent.value = nextProps.value;
}
}

Expand Down

0 comments on commit cd2111d

Please sign in to comment.