react-native-checkbox-heaven
react-native-checkbox-heaven copied to clipboard
Cannot prevent checkbox from being checked
There is no disabled or prevent interaction with the checkbox and onChange you can't return false to prevent the box from being checked
Still checked={this.state} has no effect when doing setState
was it suppose to be fixed with commit#3731f5e?
@bcitdaltond Are you still having this problem? If so, is there a reason you can't simply set checked={false}
in the properties?
I'm having something similar. If I set disabled to true I would expect that the state of the checkbox doesn't change. or with an empty function maybe ?.
<CheckBox disabled={true} checked={this.state.checkbox} onChange={() => {}} label="test" />
I fixed it, in the method _onChange added a check for disabled prop:
_onChange() { if(!this.props.disabled) { const newVal = !this.state.checked const { onChange } = this.props this.setState({ checked:newVal }, () => { onChange(newVal) }) } }