Skip to content

Commit

Permalink
Add info to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bert committed Dec 15, 2023
1 parent 0c20360 commit 6d7b50b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/docs/gestures/gesture-detector.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,25 @@ This parameter allows to specify which `userSelect` property should be applied t
- Gesture Detector will use first native view in its subtree to recognize gestures, however if this view is used only to group its children it may get automatically [collapsed](https://reactnative.dev/docs/view#collapsable-android). Consider this example:
<FunctionalComponents />
If we were to remove the collapsable prop from the View, the gesture would stop working because it would be attached to a view that is not present in the view hierarchy. Gesture Detector adds this prop automatically to its direct child but it's impossible to do automatically for more complex view trees.

- Using the same instance of gesture handler across multiple Gesture Detectors is not possible. Have a look at the code below:

```jsx
export default function Example() {
const pan = Gesture.Pan();

return (
<View>
<GestureDetector gesture={pan}>
<View>
<GestureDetector gesture={pan}>
<View />
</GestureDetector>
</View>
</GestureDetector>
</View>
);
}
```

This example will throw an error, becuse we try to use the same instance of `Pan` in two different Gesture Detectors.

0 comments on commit 6d7b50b

Please sign in to comment.