Pressable
Pressable is a component that can detect various parts of press interactions on any of its defined children.
Pressable
responds to touch, mouse, and keyboard interactions. The interaction state of the view is exposed to the children
and style
props which accept a callback as their value. The hover
state is only activated by mouse interactions.
import { Pressable } from 'react-native';
<Pressable {...props}>{children}</Pressable>;
API
Props
The children of the view. Supports computing children as a function of interaction state.
How long to delay calling onLongPress
after onPressIn
is called.
How long to delay calling onPressIn
after an interaction begins.
How long to delay calling onPressOut
after an interaction ends.
Disables all pointer interactions with the element.
Called when the pointer starts hovering over the element. Touch interactions have no effect.
Called when the pointer stops hovering over the element. Touch interactions have no effect.
Called when the pointer is held down for as long as the value of delayLongPress
.
Called when the pointer is released without first being cancelled (e.g. by a scroll that steals the responder lock). Equivalent to the click
DOM event.
Called when the pointer starts interacting with the element after delayPressIn
ms.
Called when the pointer stops interacting with the element after delayPressOut
ms.
The style of the view. Supports computing style as a function of interaction state.
Used only for documentation or testing (e.g. snapshot testing).
Used only for documentation or testing (e.g. snapshot testing).
InteractionState
The state object passed to function values of children
and state
reflects the current state of the user interaction with the view.
Whether the view is currently focused.
Whether the view is being hovered over by a mouse.
Whether the view is being pressed by a pointer or keyboard interaction key.