Fix switch not refresh bug.

This commit is contained in:
Kenshin 2017-08-25 11:00:01 +08:00
parent 829847a130
commit 6c484802ca

View File

@ -193,6 +193,10 @@ export default class Switch extends React.Component {
!this.props.disable && this.props.onChange && this.props.onChange( !this.state.checked );
}
componentWillReceiveProps( nextProps ) {
this.setState({ checked: nextProps.checked });
}
render() {
const style = { ...cssinjs() };
styles.set( this.state.id, style );