Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { StyleSheet } from 'react-native';
import {
GestureDetector,
GestureHandlerRootView,
usePanGesture,
usePinchGesture,
useRotationGesture,
useSimultaneousGestures,
} from 'react-native-gesture-handler';
import Animated, {
useSharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';

export default function App() {
const offset = useSharedValue({ x: 0, y: 0 });
const start = useSharedValue({ x: 0, y: 0 });

const scale = useSharedValue(1);
const savedScale = useSharedValue(1);
const rotation = useSharedValue(0);
const savedRotation = useSharedValue(0);

const animatedStyles = useAnimatedStyle(() => {
return {
transform: [
{ translateX: offset.value.x },
{ translateY: offset.value.y },
{ scale: scale.value },
{ rotateZ: `${rotation.value}rad` },
],
};
});

const dragGesture = usePanGesture({
averageTouches: true,
onUpdate: (e) => {
offset.value = {
x: e.translationX + start.value.x,
y: e.translationY + start.value.y,
};
},
onDeactivate: () => {
start.value = {
x: offset.value.x,
y: offset.value.y,
};
},
});

const zoomGesture = usePinchGesture({
onUpdate: (e) => {
scale.value = savedScale.value * e.scale;
},
onDeactivate: () => {
savedScale.value = scale.value;
},
});

const rotationGesture = useRotationGesture({
onUpdate: (e) => {
rotation.value = savedRotation.value + e.rotation;
},
onDeactivate: () => {
savedRotation.value = rotation.value;
},
});

const composedGesture = useSimultaneousGestures(
dragGesture,
zoomGesture,
rotationGesture
);

return (
<GestureHandlerRootView style={styles.container}>
<GestureDetector gesture={composedGesture}>
<Animated.View style={[styles.box, animatedStyles]} />
</GestureDetector>
</GestureHandlerRootView>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'space-around',
},
box: {
width: 100,
height: 100,
backgroundColor: 'blue',
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ sidebar_position: 5

import CollapsibleCode from '@site/src/components/CollapsibleCode';

Using hook API allows for smooth integration with the [Animated API](https://reactnative.dev/docs/animated) by allowing for passing an `Animated.event` as the argument to the `onUpdate` callback. The event mapping of `Animated.event` depends on the `useNativeDriver` property.
Using hook API allows for smooth integration with the [Animated API](https://reactnative.dev/docs/animated) by allowing for passing an `Animated.event` as the argument to the [`onUpdate`](/docs/fundamentals/callbacks-events#onupdate) callback. The event mapping of `Animated.event` depends on the [`useNativeDriver`](https://reactnative.dev/docs/animated#using-the-native-driver) property.

When using Animated API, remember to set `useAnimated` property to `true`.

:::danger Mixing Reanimated and Animated
It is not possible to mix `Reanimated` and `Animated` within any of the [gesture detectors](/docs/fundamentals/gesture-detectors).
It is not possible to mix Reanimated and Animated within any of the [gesture detectors](/docs/fundamentals/gesture-detectors).
:::

<CollapsibleCode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ sidebar_position: 7
import { GestureEventFlowChart, TouchEventFlowChart } from '@site/src/examples/CallbacksFlowCharts'
import CollapsibleCode from '@site/src/components/CollapsibleCode';

At any given time, each handler instance has an assigned [state](/docs/under-the-hood/state) that can change when new touch events occur or can be forced to change by the touch system in certain circumstances. You can hook into state transitions using specific [gesture callbacks](#callbacks).
At any given time, each handler instance has an assigned [state](/docs/under-the-hood/state) that can change when new touch events occur or can be forced to change by the touch system under certain circumstances. You can hook into state transitions using specific [gesture callbacks](#callbacks).

When `Reanimated` is installed, all callbacks are automatically workletized. For more details, refer to the [Integration with Reanimated](/docs/fundamentals/reanimated-interactions#automatic-workletization-of-gesture-callbacks) section.
When Reanimated is installed, all callbacks are automatically workletized. For more details, refer to the [Integration with Reanimated](/docs/fundamentals/reanimated-interactions#automatic-workletization-of-gesture-callbacks) section.

## Callbacks flow

Expand Down
Loading
Loading