Usage
Props
number
default:"0.85"
Determines what the opacity of the wrapped view should be when touch is active.
ColorValue
default:"'black'"
The color of the underlay that shows through when the touch is active. This creates the “highlight” effect.
(event: GestureResponderEvent) => void
Called when the touch is released, but not if cancelled (e.g., by a scroll).
(event: GestureResponderEvent) => void
Called when a touch is engaged, before
onPress.(event: GestureResponderEvent) => void
Called when the touch is released or cancelled.
(event: GestureResponderEvent) => void
Called when the user holds down the press for more than
delayLongPress milliseconds.() => void
Called immediately after the underlay is shown.
() => void
Called immediately after the underlay is hidden.
boolean
default:"false"
If true, disables all interactions for this component.
number
default:"0"
Delay in milliseconds from the start of the touch before
onPressIn is called.number
default:"0"
Delay in milliseconds from the release of the touch before
onPressOut is called.number
default:"500"
Delay in milliseconds from
onPressIn before onLongPress is called.Insets
Defines how far the touch can start away from the button. Extends the touchable area without changing visual layout.
Insets
Defines how far the touch can move off the button before deactivating it.
ViewStyleProp
Style applied to the wrapper View.
How It Works
When pressed, TouchableHighlight:- Wraps your child in a View
- Reduces the child’s opacity to
activeOpacity - Shows the
underlayColorthrough the transparent child - Restores opacity when released
Make sure your child component has an explicit
backgroundColor set, otherwise the underlay effect may not be visible.Common Patterns
Button Component
List Item
With Image
Tracking Press State
Comparison with Other Touchables
- TouchableHighlight: Shows underlay color when pressed. Best for opaque backgrounds.
- TouchableOpacity: Fades opacity when pressed. Simpler and more commonly used.
- TouchableWithoutFeedback: No visual feedback. Should be avoided unless necessary.
- Pressable: Modern replacement with more flexibility and better performance.
For new projects, consider using Pressable instead, which offers more customization and better performance.