Reputation: 260
I created a native UI component for android using react native, I can display it on the screen but I'd like to add an onPress event to it. How could I do that?
Upvotes: 1
Views: 798
Reputation: 2555
You can wrap your components with TouchableOpacity or TouchableHighlight. And you can easily add event listener in this way:
<TouchableOpacity onPress={MY_FUNC}>
<MyComponent />
</TouchableOpacity>
Upvotes: 3