Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5736594
updated pan gesture view and pan gesture example to use v3 api
Apr 14, 2026
f201788
removed videos and migarted examples in all gesture pages
Apr 14, 2026
8598093
not using the GestureBasicSrc files other than for legacy and simplif…
Apr 14, 2026
6e2f843
fixed pinch gesture example
Apr 15, 2026
3eb98c2
updated legacy a
Apr 15, 2026
4ef9b94
fixed inconsitent container sizes
Apr 15, 2026
3e656ce
removed vidoes from v2 docs and added examples in v2 api
Apr 15, 2026
a7133eb
fixed visual inconsitencies in v2 api the same as in v3
Apr 15, 2026
7bac454
updated pinch gesture to work the same way in the v2 doc as in v3
Apr 15, 2026
f5cd5d4
updated the min size for pinch gesture box
Apr 15, 2026
0eb4a36
fixed stucture incosistency in pinch on v3 and v2
Apr 15, 2026
63ade96
fixed the refs passed from GestureHandlerRootView
Apr 15, 2026
4067fd4
fixed the style placement
Apr 15, 2026
9afe89f
Merge branch 'main' of github.com:software-mansion/react-native-gestu…
relextm19 Apr 15, 2026
75d8e72
fixed scroll bug with pinch example
relextm19 Apr 15, 2026
cbd11de
removed pointer events from dots in pinch to avoid blocked interaction
relextm19 Apr 15, 2026
8e4f433
Merge branch 'main' of github.com:software-mansion/react-native-gestu…
relextm19 Apr 16, 2026
df9a7ae
Update packages/docs-gesture-handler/static/examples/PanGestureBasic.js
relextm19 Apr 16, 2026
ab95924
Update packages/docs-gesture-handler/static/examples/PanGestureBasic.js
relextm19 Apr 17, 2026
2fe80f5
Update packages/docs-gesture-handler/package.json
relextm19 Apr 17, 2026
6c663b2
readded src for pinch and rotate
relextm19 Apr 17, 2026
3c9f5ba
simplified pan in v3 by using event.changeX
relextm19 Apr 17, 2026
f64dad0
Merge branch '@relextm19/docs-examples' of github.com:software-mansio…
relextm19 Apr 17, 2026
5e74fcb
changed styles
relextm19 Apr 17, 2026
bbe136f
simplified tap example
relextm19 Apr 17, 2026
1b1612d
pinch example no longer resizing
relextm19 Apr 17, 2026
8dc5f01
pinch example no longer resizing in v2
relextm19 Apr 17, 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
2 changes: 1 addition & 1 deletion packages/docs-gesture-handler/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: ['react-native-reanimated/plugin'],
plugins: ['react-native-worklets/plugin'],
};
17 changes: 2 additions & 15 deletions packages/docs-gesture-handler/docs/gestures/use-fling-gesture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@ sidebar_label: Fling gesture
sidebar_position: 6
---

import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/getGestureStyles';

import useBaseUrl from '@docusaurus/useBaseUrl';
import { webContainer } from '@site/src/utils/getGestureStyles';

import FlingGestureBasic from '@site/static/examples/FlingGestureBasic';
import FlingGestureBasicSrc from '!!raw-loader!@site/static/examples/FlingGestureBasicSrc';
import FlingGestureBasicSrc from '!!raw-loader!@site/static/examples/FlingGestureBasic';


import MouseButtonProp from './\_shared/mouse-button.mdx';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/fling.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<FlingGestureBasic/>}
src={FlingGestureBasicSrc}
Expand All @@ -37,12 +30,6 @@ The gesture that tracks quick, sufficiently long movement in specified [directio
When the gesture gets activated it will end when the finger is released.
The gesture will fail if the finger is lifted before the gesture could activate.

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/fling.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ sidebar_label: Hover gesture
sidebar_position: 7
---

import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/getGestureStyles';

import useBaseUrl from '@docusaurus/useBaseUrl';
import { webContainer } from '@site/src/utils/getGestureStyles';

import HoverGestureBasic from '@site/static/examples/HoverGestureBasic';
import HoverGestureBasicSrc from '!!raw-loader!@site/static/examples/HoverGestureBasic';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/hover.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<HoverGestureBasic/>}
src={HoverGestureBasicSrc}
Expand All @@ -35,12 +28,6 @@ Gesture that can recognize hovering above the view it's attached to. The hover e

On iOS additional [visual effects](#effect-ios-only) may be configured.

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/hover.mp4")} type="video/mp4"/>
</video>
</div>

:::note
Don't rely on `Hover` gesture to continue after the mouse button is clicked or the stylus touches the screen. If you want to handle both cases, [compose](/docs/fundamentals/gesture-composition) it with [`Pan`](/docs/gestures/use-pan-gesture) gesture.
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@ sidebar_label: Long press gesture
sidebar_position: 3
---

import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/getGestureStyles';

import useBaseUrl from '@docusaurus/useBaseUrl';
import { webContainer } from '@site/src/utils/getGestureStyles';

import LongPressGestureBasic from '@site/static/examples/LongPressGestureBasic';
import LongPressGestureBasicSrc from '!!raw-loader!@site/static/examples/LongPressGestureBasic';

import MouseButtonProp from './\_shared/mouse-button.mdx';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/longpress.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<LongPressGestureBasic/>}
src={LongPressGestureBasicSrc}
Expand All @@ -38,12 +31,6 @@ Gesture that activates when the corresponding view is pressed for a sufficiently
This gesture will deactivate immediately after the finger is released.
The gesture will fail to recognize a touch event if the finger is lifted before the [minimum required time](#minduration) or if the finger is moved further than the [allowable distance](#maxdistance).

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/longpress.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
13 changes: 1 addition & 12 deletions packages/docs-gesture-handler/docs/gestures/use-pan-gesture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/ge
import useBaseUrl from '@docusaurus/useBaseUrl';

import PanGestureBasic from '@site/static/examples/PanGestureBasic';
import PanGestureBasicSrc from '!!raw-loader!@site/static/examples/PanGestureBasicSrc';
import PanGestureBasicSrc from '!!raw-loader!@site/static/examples/PanGestureBasic';

import BaseEventData from './\_shared/base-gesture-event-data.mdx';
import BaseGestureConfig from './\_shared/base-gesture-config.mdx';
Expand All @@ -21,11 +21,6 @@ import SharedValueInfo from './\_shared/shared-value-info.md';
import MouseButtonProp from './\_shared/mouse-button.mdx';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/pan.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<PanGestureBasic/>}
src={PanGestureBasicSrc}
Expand All @@ -41,12 +36,6 @@ Configurations such as a minimum initial distance, specific vertical or horizont

Gesture callback can be used for continuous tracking of the pan gesture. It provides information about the gesture such as its XY translation from the starting point as well as its instantaneous velocity.

<div className={appearOnMobile} style={{ display: 'flex', margin: '16px 0', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/pan.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ sidebar_label: Pinch gesture
sidebar_position: 5
---

import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/getGestureStyles';

import useBaseUrl from '@docusaurus/useBaseUrl';
import { webContainer } from '@site/src/utils/getGestureStyles';

import PinchGestureBasic from '@site/static/examples/PinchGestureBasic';
import PinchGestureBasicSrc from '!!raw-loader!@site/static/examples/PinchGestureBasicSrc';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/pinch.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<PinchGestureBasic/>}
src={PinchGestureBasicSrc}
Expand Down Expand Up @@ -45,12 +38,6 @@ For example, map views use pinch gestures to change the zoom level of the map.
When implementing pinch based on focal point, make sure to use it after the gesture had activated, i.e. in `onActivate` or `onUpdate` callbacks. Using it in `onBegin` may lead to unexpected behavior.
:::

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/pinch.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ sidebar_label: Rotation gesture
sidebar_position: 4
---

import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/getGestureStyles';

import useBaseUrl from '@docusaurus/useBaseUrl';
import { webContainer } from '@site/src/utils/getGestureStyles';

import RotationGestureBasic from '@site/static/examples/RotationGestureBasic';
import RotationGestureBasicSrc from '!!raw-loader!@site/static/examples/RotationGestureBasicSrc';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/rotation.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<RotationGestureBasic/>}
src={RotationGestureBasicSrc}
Expand All @@ -42,12 +35,6 @@ The gesture activates when fingers are placed on the screen and rotate around a
When implementing rotation based on `anchor` point, make sure to use it after the gesture had activated, i.e. in `onActivate` or `onUpdate` callbacks. Using it in `onBegin` may lead to unexpected behavior.
:::

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/rotation.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
11 changes: 0 additions & 11 deletions packages/docs-gesture-handler/docs/gestures/use-tap-gesture.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import TapGestureBasicSrc from '!!raw-loader!@site/static/examples/TapGestureBas
import MouseButtonProp from './\_shared/mouse-button.mdx';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/tap.mp4")} type="video/mp4"/>
</video>
</div>
<InteractiveExample
component={<TapGestureBasic/>}
src={TapGestureBasicSrc}
Expand All @@ -41,12 +36,6 @@ For example, you might configure tap gesture recognizers to detect single taps,

In order for a gesture to activate, the specified gesture requirements such as [`minPointers`](#minpointers), [`numberOfTaps`](#numberoftaps), [`maxDistance`](#maxdistance), [`maxDuration`](#maxduration), and [`maxDelay`](#maxdelay) must be met.

<div className={appearOnMobile} style={{ display: 'flex', justifyContent: 'center' }}>
<video playsInline autoPlay muted loop style={{maxWidth: 360}}>
<source src={useBaseUrl("/video/tap.mp4")} type="video/mp4"/>
</video>
</div>

## Example

<CollapsibleCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/ge
import useBaseUrl from '@docusaurus/useBaseUrl';

import FlingGestureBasic from '@site/static/examples/FlingGestureBasic';
import FlingGestureBasicSrc from '!!raw-loader!@site/static/examples/FlingGestureBasicSrc';
import FlingGestureBasicSrc from '!!raw-loader!@site/static/examples/FlingGestureBasic';

import OldAPIInfo from './\_shared/v2-info.md'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/ge
import useBaseUrl from '@docusaurus/useBaseUrl';

import PanGestureBasic from '@site/static/examples/PanGestureBasic';
import PanGestureBasicSrc from '!!raw-loader!@site/static/examples/PanGestureBasicSrc';
import PanGestureBasicSrc from '!!raw-loader!@site/static/examples/PanGestureBasic';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/ge
import useBaseUrl from '@docusaurus/useBaseUrl';

import PinchGestureBasic from '@site/static/examples/PinchGestureBasic';
import PinchGestureBasicSrc from '!!raw-loader!@site/static/examples/PinchGestureBasicSrc';
import PinchGestureBasicSrc from '!!raw-loader!@site/static/examples/PinchGestureBasic';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { vanishOnMobile, appearOnMobile, webContainer } from '@site/src/utils/ge
import useBaseUrl from '@docusaurus/useBaseUrl';

import RotationGestureBasic from '@site/static/examples/RotationGestureBasic';
import RotationGestureBasicSrc from '!!raw-loader!@site/static/examples/RotationGestureBasicSrc';
import RotationGestureBasicSrc from '!!raw-loader!@site/static/examples/RotationGestureBasic';

<div className={webContainer}>
<div className={vanishOnMobile} style={{ display: 'flex', justifyContent: 'center', maxWidth: 360 }}>
Expand Down
8 changes: 4 additions & 4 deletions packages/docs-gesture-handler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"react-dom": "19.1.1",
"react-draggable": "^4.4.5",
"react-native": "0.83.0",
"react-native-gesture-handler": "^2.24.0",
"react-native-reanimated": "4.0.0-nightly-20250325-d67e51599",
"react-native-web": "^0.18.12",
"react-native-worklets": "^0.1.0",
"react-native-gesture-handler": "3.0.0-beta.2",
"react-native-reanimated": "4.3.0",
"react-native-web": "0.21.2",
"react-native-worklets": "0.8.1",
"source-map": "^0.7.4",
"source-map-loader": "^4.0.1",
"usehooks-ts": "^2.9.1",
Expand Down
20 changes: 9 additions & 11 deletions packages/docs-gesture-handler/static/examples/FlingGestureBasic.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React from 'react';
import {
Directions,
Gesture,
GestureDetector,
GestureHandlerRootView,
useFlingGesture,
} from 'react-native-gesture-handler';
import { StyleSheet, View } from 'react-native';
import Animated, {
clamp,
withTiming,
useSharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';

function clamp(val, min, max) {
return Math.min(Math.max(val, min), max);
}

export default function App() {
const translateX = useSharedValue(0);
const startTranslateX = useSharedValue(0);
Expand Down Expand Up @@ -49,12 +46,12 @@ export default function App() {
};
}, []);

const fling = Gesture.Fling()
.direction(Directions.LEFT | Directions.RIGHT)
.onBegin((event) => {
const fling = useFlingGesture({
direction: Directions.LEFT | Directions.RIGHT,
onBegin: (event) => {
startTranslateX.value = event.x;
})
.onStart((event) => {
},
onActivate: (event) => {
translateX.value = withTiming(
clamp(
translateX.value + event.x - startTranslateX.value,
Expand All @@ -63,7 +60,8 @@ export default function App() {
),
{ duration: 200 }
Comment thread
m-bert marked this conversation as resolved.
);
});
},
});

const boxAnimatedStyles = useAnimatedStyle(() => ({
transform: [{ translateX: translateX.value }],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
useHoverGesture,
} from 'react-native-gesture-handler';
import { StyleSheet } from 'react-native';
import Animated, {
Expand All @@ -24,20 +24,20 @@ export default function App() {
const startX = useSharedValue(0);
const startY = useSharedValue(0);

const hover = Gesture.Hover()
.onStart((event) => {
const hover = useHoverGesture({
onActivate: (event) => {
startX.value = event.x;
startY.value = event.y;
})
.onUpdate((event) => {
},
onUpdate: (event) => {
translateX.value = (event.x - startX.value) * 0.3;
translateY.value = (event.y - startY.value) * 0.3;

const distance = Math.sqrt(Math.pow(translateX.value, 2) + Math.pow(translateY.value, 2));

progress.value = distance / 35;
})
.onEnd(() => {
},
onDeactivate: () => {
translateX.value = withTiming(0, {
duration: 400,
easing: EASING,
Expand All @@ -50,7 +50,8 @@ export default function App() {
duration: 400,
easing: EASING,
});
});
},
});

const boxAnimatedStyle = useAnimatedStyle(() => ({
transform: [
Expand Down
Loading
Loading