mirror of
https://github.com/Kenshin/simpread.git
synced 2026-01-25 14:28:34 +00:00
Fix switch not refresh bug.
This commit is contained in:
parent
829847a130
commit
6c484802ca
@ -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 );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user