Giving touch feedback
The React Native examples you’ve worked with so far in this book have used plain text to act as buttons or links. In web applications, to make text look like something that can be clicked, you just wrap it with the appropriate link. There’s no link component in React Native, so you can style your text to look like a button.
The problem with trying to style text as links on mobile devices is that they’re too hard to press. Buttons provide a bigger target for fingers, and they’re easier to apply touch feedback on.
Let’s style some text as a button. This is a great first step as it makes the text look touchable. But you also want to give visual feedback to the user when they start interacting with the button. React Native provides several components to help with this:
TouchableOpacity
TouchableHighlight
- Pressable API
But before diving into the code, let’s take a look...