Skip to content

Commit 6fed3c3

Browse files
committed
Add useAnimated flag
1 parent 2df4f82 commit 6fed3c3

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

packages/docs-gesture-handler/docs/fundamentals/animated-interactions.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ import CollapsibleCode from '@site/src/components/CollapsibleCode';
99

1010
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.
1111

12+
When using Animated API, remember to set `useAnimated` property to `true`.
13+
1214
:::danger Mixing Reanimated and Animated
1315
It is not possible to mix `Reanimated` and `Animated` within any of the [gesture detectors](/docs/fundamentals/gesture-detectors).
1416
:::
1517

1618
<CollapsibleCode
1719
label="Show full example"
1820
expandedLabel="Hide full example"
19-
lineBounds={[8, 31]}
21+
lineBounds={[8, 33]}
2022
src={`
2123
import * as React from 'react';
2224
import { Animated, StyleSheet, useAnimatedValue } from 'react-native';
@@ -39,6 +41,8 @@ export default function App() {
3941
const gesture = usePanGesture({
4042
// highlight-next-line
4143
onUpdate: event,
44+
// highlight-next-line
45+
useAnimated: true,
4246
});
4347
4448
return (

packages/docs-gesture-handler/docs/gestures/_shared/base-gesture-config.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ If set to `true`, callbacks will be executed on JS runtime. Can be changed dynam
8787
**Requires `react-native-reanimated`**
8888

8989
```ts
90-
disableReanimated: boolean | SharedValue<boolean>;
90+
disableReanimated: boolean;
9191
```
9292

9393
If set to `true`, the gesture will ignore any interaction with `Reanimated`. This property cannot be changed during the gesture's lifecycle. For more details, see the [disableReanimated](/docs/fundamentals/reanimated-interactions#disablereanimated) section.
@@ -122,6 +122,14 @@ Adds a relation that makes other gestures wait with activation until this gestur
122122

123123
**IMPORTANT:** Note that this method only marks the relation between gestures, without [composing them](/docs/fundamentals/gesture-composition).[`GestureDetector`](/docs/fundamentals/gesture-detectors#gesture-detector) will not recognize the `otherGestures` and it needs to be added to another detector in order to be recognized.
124124

125+
### useAnimated
126+
127+
```ts
128+
useAnimated: boolean;
129+
```
130+
131+
Setting this property is set to `true` ensures that the [Animated API](/docs/fundamentals/animated-interactions) functions correctly when `useNativeDriver` is set to `false`. The default value is set to `false`.
132+
125133
### activeCursor
126134

127135
```ts

0 commit comments

Comments
 (0)