Skip to content

Commit

Permalink
Fix @Harton review
Browse files Browse the repository at this point in the history
  • Loading branch information
c3dr0x committed Jul 25, 2017
1 parent be33f10 commit 54368cb
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/components/input/select-checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,17 @@ class SelectCheckbox extends Component {
* @param {[type]} newStatus the new status
*/
_handleCheckboxChange(key, newStatus) {
const selectedValues = this.state.selectedValues;
if (newStatus) {
selectedValues.push(key);
} else {
pull(selectedValues, key);
}
const selectedValues = newStatus
? this.state.selectedValues.concat([key])
: this.state.selectedValues.filter(elt => elt !== key);

if (this.props.onChange) {
if (this.props.legacyOnChange) {
this.props.onChange(key, newStatus);
} else {
this.props.onChange(selectedValues);
}
return;
if (this.props.onChange && this.props.legacyOnChange) {
this.props.onChange(key, newStatus);
} else if (this.props.onChange) {
this.props.onChange(selectedValues);
} else {
this.setState({ value: selectedValues });
}

this.setState({ value: selectedValues });
}

/**
Expand Down

0 comments on commit 54368cb

Please sign in to comment.