1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +02:00

Check for the checkbox being unchecked before reseting value

This commit is contained in:
Brett Sun 2015-12-16 15:45:54 +01:00
parent fb917f1a09
commit 9f553f973c

View File

@ -240,10 +240,17 @@ const Property = React.createClass({
},
handleCheckboxToggle() {
this.setExpanded(!this.state.expanded);
this.setState({
value: this.state.initialValue
});
const expanded = !this.state.expanded;
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) {