mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Check for the checkbox being unchecked before reseting value
This commit is contained in:
parent
fb917f1a09
commit
9f553f973c
@ -240,10 +240,17 @@ const Property = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleCheckboxToggle() {
|
handleCheckboxToggle() {
|
||||||
this.setExpanded(!this.state.expanded);
|
const expanded = !this.state.expanded;
|
||||||
this.setState({
|
|
||||||
value: this.state.initialValue
|
this.setExpanded(expanded);
|
||||||
});
|
|
||||||
|
// Reset the value to be the initial value when the checkbox is unticked since the
|
||||||
|
// user doesn't want to specify their own value.
|
||||||
|
if (!expanded) {
|
||||||
|
this.setState({
|
||||||
|
value: this.state.initialValue
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
renderChildren(style) {
|
renderChildren(style) {
|
||||||
|
Loading…
Reference in New Issue
Block a user