mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
fix gc checkbox
This commit is contained in:
@@ -23,6 +23,16 @@ export default class Checkbox extends React.Component<IProps, IState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getDerivedStateFromProps(props: IProps, state: IState) {
|
||||||
|
if (props.checked !== state.checked) {
|
||||||
|
return {
|
||||||
|
checked: props.checked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
handleChange = () => {
|
handleChange = () => {
|
||||||
this.setState({ checked: !this.state.checked })
|
this.setState({ checked: !this.state.checked })
|
||||||
this.props.onChange()
|
this.props.onChange()
|
||||||
|
|||||||
Reference in New Issue
Block a user