You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this is expected behavior. That is standard functionality in web development, and I believe was purposely copied here. If you want to have a label that doesn't trigger onChange simply set label to null and add a <Text> component before or after the <Checkbox> component
Clicking on a the label text triggers onChange for some reason.
Here is my entire checkBox component:
`import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import CheckBox from 'react-native-checkbox';
class PrepositionCheckBox extends React.Component {
componentWillMount() {
if (this.props.transitive === true) {
this.props.handleInitialStateOfActivePrepositionCheckbox(false);
}
}
render() {
return (
<CheckBox
checkboxStyle={styles.prepositionCheckBox}
labelBefore={true}
label={this.props.prepositionCheckBoxLabel}
labelStyle={styles.prepositionCheckBoxLabel}
checked={this.props.prepositionCheckBoxState}
onChange={(prepositionCheckBoxCategory, checked) => this.props.handleCheckBoxClick(this.props.prepositionCheckBoxCategory, this.props.prepositionCheckBoxState)} />
);
}
}
const styles = StyleSheet.create({
prepositionCheckBoxRow: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'flex-start'
},
prepositionCheckBoxLabel: {
height: 25
}
});
export default PrepositionCheckBox;`
The text was updated successfully, but these errors were encountered: