From the course: Learning React Native

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using a touchable highlight

Using a touchable highlight

From the course: Learning React Native

Start my 1-month free trial

Using a touchable highlight

- [Instructor] The touchable highlight is a component that we can use to make an entire group of elements respond to a touch. Currently when the user presses either of these text elements we're changing the background color of the containing view. Instead of adding the onPress property to the text handler, let's use a touchable highlight. The touchable highlight will allow us to add press events to an entire group of components. So I'm going to go ahead and remove both of these text elements and I'm going to add a touchable highlight. Under this touchable highlight I'll also add a view. Within the view we'll display the word yellow inside of a text component. We already have some styles in our stylesheet here for a button so I'm going to go ahead and add the button styles to our TouchableHighlight. When I save this you'll see that we have a little warning over here. So this warning here says that we have a failed…

Contents