TouchableNativeFeedback
On Android, this touchable draws the system ripple. On iOS, React Native shows no feedback, and the press works as on TouchableWithoutFeedback. The web does the same as iOS.
import { Text, TouchableNativeFeedback, View } from 'react-native'
const ripple = TouchableNativeFeedback.Ripple('#2563eb', false)
export function Item({ onOpen }) {
return (
<TouchableNativeFeedback role="button" background={ripple} onPress={onOpen}>
<View>
<Text>Open</Text>
</View>
</TouchableNativeFeedback>
)
}
The child gets the press handlers and the accessibility props, as with TouchableWithoutFeedback.
Props
| Prop | On the web |
|---|---|
background, useForeground | Android only. Accepted and ignored, as on iOS. |
The props of TouchableWithoutFeedback | As on TouchableWithoutFeedback. |
hasTVPreferredFocus, nextFocusDown and others | TV only. Accepted and ignored. |
Static methods
| Method | On the web |
|---|---|
SelectableBackground(rippleRadius?) | Returns the same object as on native, for background. |
SelectableBackgroundBorderless(rippleRadius?) | Returns the same object as on native, for background. |
Ripple(color, borderless, rippleRadius?) | Returns the same object as on native, with the color from processColor. |
canUseNativeForeground() | false, as on iOS. |
The React Compiler lint and
RippleThe React Compiler lint reads a capitalized call in a component, such as TouchableNativeFeedback.Ripple(...), as a component, and reports capitalized-calls. Make the call once outside the component, as in the example.