Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a14db83
Fix edit link
m-bert Feb 4, 2026
9e1f534
introduction
m-bert Feb 4, 2026
54889bb
installation
m-bert Feb 4, 2026
3e82cf8
Gesture detector
m-bert Feb 4, 2026
e005621
Reanimated interactions
m-bert Feb 4, 2026
90b1aa4
Animated interactions
m-bert Feb 4, 2026
a5b73b3
Composition
m-bert Feb 5, 2026
6c4aa0f
Merge branch 'main' into @mbert/docs-review
m-bert Feb 6, 2026
b2f97c5
State manager
m-bert Feb 5, 2026
8cb20ab
Callbacks
m-bert Feb 5, 2026
8f442f1
Quickstart
m-bert Feb 5, 2026
12abfeb
Troubleshooting
m-bert Feb 5, 2026
1094f92
Testing
m-bert Feb 6, 2026
d91e097
Fix callbacks flow chart
m-bert Feb 6, 2026
c503ea1
Pan
m-bert Feb 6, 2026
31a8db3
Tap
m-bert Feb 6, 2026
b3efbbe
LongPress
m-bert Feb 6, 2026
d201b3e
Rotation
m-bert Feb 6, 2026
62d0fe8
Pinch
m-bert Feb 6, 2026
64aa192
Fling
m-bert Feb 6, 2026
4667c7d
Hover
m-bert Feb 6, 2026
5f40baf
Native
m-bert Feb 6, 2026
800b37d
Manual
m-bert Feb 6, 2026
004f919
Touch events
m-bert Feb 6, 2026
e8ddacc
Pinch typo
m-bert Feb 6, 2026
128b226
HOOOOOOOOOOOOOOOOOOOOW?
m-bert Feb 6, 2026
cc1e783
Update packages/docs-gesture-handler/docs/guides/testing.md
m-bert Feb 9, 2026
d48e4ea
Update packages/docs-gesture-handler/docs/fundamentals/gesture-detect…
m-bert Feb 9, 2026
9f1ec51
Overrides
m-bert Feb 9, 2026
9b4aff8
Fix broken link
m-bert Feb 9, 2026
0ce4f89
Merge branch 'main' into @mbert/docs-review
m-bert Feb 9, 2026
1b48239
Pressable
m-bert Feb 9, 2026
e9e88a5
Swipeable
m-bert Feb 9, 2026
5fcdc6c
Drawer
m-bert Feb 9, 2026
6d909f3
Minor adjustments
m-bert Feb 10, 2026
6563cdc
Update packages/docs-gesture-handler/docs/fundamentals/gesture-detect…
m-bert Feb 11, 2026
f3500a4
Update kotlin version
m-bert Feb 11, 2026
9840339
Merge branch '@mbert/docs-review' of github.com:software-mansion/reac…
m-bert Feb 11, 2026
3d706ec
Update packages/docs-gesture-handler/docs/fundamentals/state-manager.mdx
m-bert Feb 11, 2026
2a877d9
Update packages/docs-gesture-handler/docs/fundamentals/state-manager.mdx
m-bert Feb 11, 2026
f927bf5
Remove ts block
m-bert Feb 11, 2026
18e4350
Update packages/docs-gesture-handler/docs/gestures/use-native-gesture…
m-bert Feb 11, 2026
8232dc8
Merge branch 'main' into @mbert/docs-review
m-bert Feb 11, 2026
264a843
Merge branch '@mbert/docs-review' of github.com:software-mansion/reac…
m-bert Feb 11, 2026
4fd4d8c
Rea and Ani
m-bert Feb 11, 2026
a09df73
Move examples to separate files
m-bert Feb 11, 2026
f94da57
Remove a
m-bert Feb 11, 2026
c9c429e
manualActivation
m-bert Feb 11, 2026
ca8179c
Merge branch 'main' into @mbert/docs-review
m-bert Feb 12, 2026
788827a
Update packages/docs-gesture-handler/docs/fundamentals/installation.mdx
m-bert Feb 12, 2026
d247707
Merge branch '@mbert/docs-review' of github.com:software-mansion/reac…
m-bert Feb 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
238 changes: 171 additions & 67 deletions packages/docs-gesture-handler/docs/components/pressable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,133 +7,237 @@ sidebar_label: Pressable
import useBaseUrl from '@docusaurus/useBaseUrl';
import GifGallery from '@site/components/GifGallery';

<GifGallery>
<img src={useBaseUrl('gifs/pressable.gif')} width="70%" />
</GifGallery>

:::info
This component is a drop-in replacement for the `Pressable` component.
:::

`Pressable` is a component that can detect various stages of tap, press, and hover interactions on any of its children.
<GifGallery>
<img src={useBaseUrl('gifs/pressable.gif')} width="70%" />
</GifGallery>

### Usage:
`Pressable` is a component that can detect various stages of tap, press, and hover interactions on any of its children.

To use `Pressable`, import it in the following way:
To use `Pressable`, ensure that your app is wrapped in `GestureHandlerRootView` and import it as follows:

```js
```ts
import { Pressable } from 'react-native-gesture-handler';
```

## Properties

### `children`
### children

```ts
children?:
| React.ReactNode
| ((state: PressableStateCallbackType) => React.ReactNode);
```

Either children or a render prop that receives a boolean reflecting whether the component is currently pressed.

### style

```ts
style?:
| StyleProp<ViewStyle>
| ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
```

either children or a render function that receives a boolean reflecting whether
the component is currently pressed.
Either view styles or a function that receives a boolean reflecting whether the component is currently pressed and returns view styles.

### `style`
### onPress

either view styles or a function that receives a boolean reflecting whether
the component is currently pressed and returns view styles.
```ts
onPress?: null | ((event: PressableEvent) => void);
```

### `onPress`
Called after [`onPressOut`](#onpressout) when a single tap gesture is detected. Details about the event object can be found in the [PressableEvent](#pressableevent) section below.

called after `onPressOut` when a single tap gesture is detected.
### onPressIn

### `onPressIn`
```ts
onPressIn?: null | ((event: PressableEvent) => void);
```

called before `onPress` when a touch is engaged.
Called before `onPress` when a touch is engaged. Details about the event object can be found in the [PressableEvent](#pressableevent) section below.

### `onPressOut`
### onPressOut

called before `onPress` when a touch is released.
```ts
onPressOut?: null | ((event: PressableEvent) => void);
```

### `onLongPress`
Called before `onPress` when a touch is released (before [`onPress`](#onpress)). Details about the event object can be found in the [PressableEvent](#pressableevent) section below.

called immediately after pointer has been down for at least `delayLongPress` milliseconds (`500` ms by default).
### onLongPress

After `onLongPress` has been called, `onPressOut` will be called as soon as the pointer is lifted and `onPress` will not be called at all.
```ts
onLongPress?: null | ((event: PressableEvent) => void);
```

### `cancelable`
Called immediately after pointer has been down for at least [`delayLongPress`](#delaylongpress) milliseconds.

whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`.
After `onLongPress` has been called, [`onPressOut`](#onpressout) will be called as soon as the pointer is lifted and [`onPress`](#onpress) will not be called at all.

### `onHoverIn` (Web only)
### cancelable

called when pointer is hovering over the element.
```ts
cancelable?: null | boolean;
```

### `onHoverOut` (Web only)
Whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`.

called when pointer stops hovering over the element.
### onHoverIn (Web only)

### `delayHoverIn` (Web only)
```ts
onHoverIn?: null | ((event: PressableEvent) => void);
```

duration to wait after hover in before calling `onHoverIn`.
Called when pointer is hovering over the element.

### `delayHoverOut` (Web only)
### onHoverOut (Web only)

duration to wait after hover out before calling `onHoverOut`.
```ts
onHoverOut?: null | ((event: PressableEvent) => void);
```

### `delayLongPress`
Called when pointer stops hovering over the element.

duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
### delayHoverIn (Web only)

### `disabled`
```ts
delayHoverIn?: number | null;
```

whether the `Pressable` behavior is disabled.
Duration to wait after hover in before calling `onHoverIn`.

### `hitSlop` (Android & iOS only)
### delayHoverOut (Web only)

additional distance outside of the view in which a press is detected and `onPressIn` is triggered.
```ts
delayHoverOut?: number | null;
```

Accepts values of type `number` or [`Rect`](https://reactnative.dev/docs/rect)
Duration to wait after hover out before calling `onHoverOut`.

### `pressRetentionOffset` (Android & iOS only)
### delayLongPress

additional distance outside of the view (or `hitSlop` if present) in which a touch is considered a
press before `onPressOut` is triggered.
```ts
delayLongPress?: null | number;
```

Accepts values of type `number` or [`Rect`](https://reactnative.dev/docs/rect)
Duration (in milliseconds) from `onPressIn` before `onLongPress` is called. Default value is `500` ms.

### `android_disableSound` (Android only)
### disabled

if `true`, doesn't play system sound on touch.
```ts
disabled?: null | boolean;
```

### `android_ripple` (Android only)
Whether the `Pressable` behavior is disabled.

enables the Android ripple effect and configures its color, radius and other parameters.
### hitSlop (Android & iOS only)

Accepts values of type [`RippleConfig`](https://reactnative.dev/docs/pressable#rippleconfig)
```ts
hitSlop?: null | Insets | number;
```

### `testOnly_pressed`
Additional distance outside of the view in which a press is detected and [`onPressIn`](#onpressin) is triggered.

used only for documentation or testing (e.g. snapshot testing).
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).

### `unstable_pressDelay`
### pressRetentionOffset (Android & iOS only)

duration (in milliseconds) to wait after press down before calling `onPressIn`.
```ts
pressRetentionOffset?: null | Insets | number;
```

### Example:
Additional distance outside of the view (or [`hitSlop`](#hitslop) if present) in which a touch is considered a
press before [`onPressOut`](#onpressout) is triggered.

See the full [pressable example](https://github.com/software-mansion/react-native-gesture-handler/blob/main/apps/common-app/src/new_api/pressable/index.tsx) from `GestureHandler` example app.
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).

import GestureStateFlowExample from '@site/src/examples/GestureStateFlowExample';
### android_disableSound (Android only)

```js
```ts
android_disableSound?: null | boolean;
```

If `true`, doesn't play system sound on touch.

### android_ripple (Android only)

```ts
android_ripple?: null | PressableAndroidRippleConfig;
```

Enables the Android [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) effect and configures its color, radius and other parameters.

Accepts values of type [`RippleConfig`](https://reactnative.dev/docs/pressable#rippleconfig).

### testOnly_pressed

```ts
testOnly_pressed?: null | boolean;
```

Used only for documentation or testing (e.g. snapshot testing).

### unstable_pressDelay

```ts
unstable_pressDelay?: number | undefined;
```

Duration (in milliseconds) to wait after press down before calling [`onPressIn`](#onpressin).

## PressableEvent

All `Pressable` callbacks receive an event object as a parameter, which is of type `PressableEvent` and has the following structure:

```ts
export type PressableEvent = { nativeEvent: InnerPressableEvent };

export type InnerPressableEvent = {
changedTouches: InnerPressableEvent[];
identifier: number;
locationX: number;
locationY: number;
pageX: number;
pageY: number;
target: number;
timestamp: number;
touches: InnerPressableEvent[];
force?: number;
};
```

## Example

See the full example in [Gesture Handler repository](https://github.com/software-mansion/react-native-gesture-handler/blob/main/apps/common-app/src/legacy/v2_api/pressable/index.tsx).

<CollapsibleCode
label="Show full example"
expandedLabel="Hide full example"
lineBounds={[5, 20]}
src={`
import { View, Text, StyleSheet } from 'react-native';
import { Pressable } from 'react-native-gesture-handler';
import {
GestureHandlerRootView,
Pressable,
} from 'react-native-gesture-handler';

export default function Example() {
return (
<Pressable
style={({ pressed }) => (pressed ? styles.highlight : styles.pressable)}
hitSlop={20}
pressRetentionOffset={20}>
<View style={styles.textWrapper}>
<Text style={styles.text}>Pressable!</Text>
</View>
</Pressable>
<GestureHandlerRootView>
<Pressable
style={({ pressed }) => (pressed ? styles.highlight : styles.pressable)}
hitSlop={20}
pressRetentionOffset={20}>
<View style={styles.textWrapper}>
<Text style={styles.text}>Pressable!</Text>
</View>
</Pressable>
</GestureHandlerRootView>
);
}

Expand All @@ -159,4 +263,4 @@ const styles = StyleSheet.create({
color: 'black',
},
});
```
`}/>
Loading
Loading