TouchableOpacity

React Native 5 min min read Updated: Jul 26, 2026 Beginner
TouchableOpacity
Beginner Topic 11 of 30

TouchableOpacity

TouchableOpacity is one of the most commonly used components for creating custom tappable elements in React Native, providing a fade-out visual effect when pressed.

Basic Usage

javascript import { TouchableOpacity, Text } from 'react-native'; console.log('Pressed')}> Tap Me

Adjusting Opacity Level

The activeOpacity prop controls how transparent the component becomes while being pressed, with a default value of 0.2.

javascript Custom Fade

Building Custom Buttons

TouchableOpacity is frequently combined with View and Text to build fully custom-styled buttons that match a specific app design.

javascript Custom Styled Button

Disabling TouchableOpacity

Setting the disabled prop to true prevents interaction and stops the onPress handler from firing, useful for temporarily disabling actions like form submission.

TouchableOpacity vs Pressable

While TouchableOpacity remains widely used and well understood, Pressable offers more flexibility and finer control over press states, making it the recommended choice for new projects.

Common Use Cases

  • Custom buttons with brand-specific styling
  • Icon buttons in headers and toolbars
  • List item interactions such as navigating to a detail screen

Conclusion

TouchableOpacity remains a reliable and widely used component for building custom touchable elements in React Native, offering simple fade feedback that enhances the perceived responsiveness of your UI.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators