Rushi trivedi
Rushi trivedi

Reputation: 747

How to put button over row In react-native?

I have text and image in one row. and now I want to put button over the row with exact size of row.

used flexDirection: 'row'

Any help?

Upvotes: 0

Views: 240

Answers (1)

Mukesh Soni
Mukesh Soni

Reputation: 6668

You can wrap your text and image inside the TouchableOpacity component

<TouchableOpacity onPress={() => doYourThing()}>
  <Text>{yourText}</Text>
  <Image source={{}} />
</TouchableOpacity>

If the text and image are already wrapped in a View, you can just replace the View component with the TouchableOpacity component. It takes all the props which View takes.

Upvotes: 1

Related Questions