react-native-elements checkbox shows 'undefined is not an object (evaluating '_this.setState')

Viewed 137

I haven't been able to find anything specific to fixing React-Native-Checkbox, everything I can find refers to an error in someones this.function(); setup.

Code:

<RNElements.CheckBox
  center
  title='Click Here'
  onPress={() => this.setState({checked: !this.state.checked})}
/>

Error:

TypeError: undefined is not an object (evaluating '_this.setState')

I understand that it doesn't know what to use setState on, but I'm not sure how to resolve it. Any ideas?

0 Answers
Related