How to add events with NativeBase components

Vishal Swaroop picture Vishal Swaroop · Aug 5, 2016 · Viewed 12.1k times · Source

What events are available for the NativeBase components?

Say for example,

  • Update the state on the input on onChangeText
  • I would like to respond to Button clicks while submitting a form

What other events those mentioned in React Native are supported with the NativeBase components?

Answer

Shivam Sinha picture Shivam Sinha · Aug 7, 2016

This should be as simple as using the onPress method props on the button component:

<Button style={{ backgroundColor: 'grey'}} onPress={() =>alert('Add payment')} block >
<Icon name="ios-add-circle-outline" />
ADD PAYMENT
</Button>