Skip to content
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
64 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
94526fd
Add other badges
m-bert Feb 12, 2026
04f992e
Add badges to pages
m-bert Feb 13, 2026
4daad27
Merge branch 'main' into @mbert/docs-badges
m-bert Feb 13, 2026
a997a49
Revert gesture-composition sidebar change
m-bert Feb 13, 2026
b6eead3
Copilot review
m-bert Feb 16, 2026
8ba5b1c
Merge branch 'main' into @mbert/docs-badges
m-bert Feb 17, 2026
d52b0f9
Add badges to buttons
m-bert Feb 17, 2026
79b7f52
Hover android
m-bert Feb 17, 2026
b45919e
Sort badges
m-bert Feb 17, 2026
b6efac4
Change android color
m-bert Feb 19, 2026
e15ee60
two finger trackpad web
m-bert Feb 19, 2026
0cd3c28
Make badges case insensitive
m-bert Feb 19, 2026
549b6a7
Merge branch 'main' into @mbert/docs-badges
m-bert Feb 19, 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
254 changes: 188 additions & 66 deletions packages/docs-gesture-handler/docs/components/pressable.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,133 +7,255 @@ sidebar_label: Pressable
import useBaseUrl from '@docusaurus/useBaseUrl';
import GifGallery from '@site/components/GifGallery';

<GifGallery>
<img src={useBaseUrl('gifs/pressable.gif')} width="70%" />
</GifGallery>
import HeaderWithBadge from '@site/src/components/HeaderWithBadge';

:::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 view styles or a function that receives a boolean reflecting whether the component is currently pressed and returns view styles.

### onPress

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

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.

### onPressIn

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

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

### onPressOut

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

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.

either children or a render function that receives a boolean reflecting whether
the component is currently pressed.
### onLongPress

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

either view styles or a function that receives a boolean reflecting whether
the component is currently pressed and returns view styles.
Called immediately after pointer has been down for at least [`delayLongPress`](#delaylongpress) milliseconds.

### `onPress`
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.

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

### `onPressIn`
```ts
cancelable?: null | boolean;
```

called before `onPress` when a touch is engaged.
Whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`.

### `onPressOut`
<HeaderWithBadge platforms={['web']}>
### onHoverIn
</HeaderWithBadge>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this also work on native when using mouse/stylus?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also thought about it. I'm not sure about iOS, I can test it on android though.


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

### `onLongPress`
Called when pointer is hovering over the element.

called immediately after pointer has been down for at least `delayLongPress` milliseconds (`500` ms by default).
<HeaderWithBadge platforms={['web']}>
### onHoverOut
</HeaderWithBadge>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


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
onHoverOut?: null | ((event: PressableEvent) => void);
```

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

whether a press gesture can be interrupted by a parent gesture such as a scroll event. Defaults to `true`.
<HeaderWithBadge platforms={['web']}>
### delayHoverIn
</HeaderWithBadge>
Comment thread
j-piasecki marked this conversation as resolved.

### `onHoverIn` (Web only)
```ts
delayHoverIn?: number | null;
```

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

### `onHoverOut` (Web only)
<HeaderWithBadge platforms={['web']}>
### delayHoverOut
</HeaderWithBadge>
Comment thread
j-piasecki marked this conversation as resolved.

called when pointer stops hovering over the element.
```ts
delayHoverOut?: number | null;
```

### `delayHoverIn` (Web only)
Duration to wait after hover out before calling `onHoverOut`.

duration to wait after hover in before calling `onHoverIn`.
### delayLongPress

### `delayHoverOut` (Web only)
```ts
delayLongPress?: null | number;
```

duration to wait after hover out before calling `onHoverOut`.
Duration (in milliseconds) from `onPressIn` before `onLongPress` is called. Default value is `500` ms.

### `delayLongPress`
### disabled

duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
```ts
disabled?: null | boolean;
```

### `disabled`
Whether the `Pressable` behavior is disabled.

whether the `Pressable` behavior is disabled.
<HeaderWithBadge platforms={['android', 'iOS']}>
### hitSlop
</HeaderWithBadge>

### `hitSlop` (Android & iOS only)
```ts
hitSlop?: null | Insets | number;
```

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

Accepts values of type `number` or [`Rect`](https://reactnative.dev/docs/rect)
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).

### `pressRetentionOffset` (Android & iOS only)
<HeaderWithBadge platforms={['android', 'iOS']}>
### pressRetentionOffset
</HeaderWithBadge>

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

Accepts values of type `number` or [`Rect`](https://reactnative.dev/docs/rect)
Additional distance outside of the view (or [`hitSlop`](#hitslop) if present) in which a touch is considered a
press before [`onPressOut`](#onpressout) is triggered.

### `android_disableSound` (Android only)
The `Insets` type is essentially the same as [`Rect`](https://reactnative.dev/docs/rect).

if `true`, doesn't play system sound on touch.
<HeaderWithBadge platforms={['android']}>
### android_disableSound
</HeaderWithBadge>

### `android_ripple` (Android only)
```ts
android_disableSound?: null | boolean;
```

enables the Android ripple effect and configures its color, radius and other parameters.
If `true`, doesn't play system sound on touch.

Accepts values of type [`RippleConfig`](https://reactnative.dev/docs/pressable#rippleconfig)
<HeaderWithBadge platforms={['android']}>
### android_ripple
</HeaderWithBadge>

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

used only for documentation or testing (e.g. snapshot testing).
Enables the Android [ripple](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable) effect and configures its color, radius and other parameters.

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

duration (in milliseconds) to wait after press down before calling `onPressIn`.
### testOnly_pressed

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

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.
Used only for documentation or testing (e.g. snapshot testing).

import GestureStateFlowExample from '@site/src/examples/GestureStateFlowExample';
### unstable_pressDelay

```js
```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 +281,4 @@ const styles = StyleSheet.create({
color: 'black',
},
});
```
`}/>
Loading