Closed latekvo closed 1 month ago
This PR fixes invalid activation of gestures nested inside other gestures, like Pan gesture nested inside Native gesture attached to ScrollView
Pan
Native
ScrollView
Gestures nested inside native elements such as ScrollView used to be able to steal pointers from their already active parents.
That is no longer possible, already active parents cannot have their active pointers stolen.
Related to #2622
EmptyExample.tsx
Gesture.Simultaneous()
simultaneousWithExternalGesture()
Description
This PR fixes invalid activation of gestures nested inside other gestures, like
Pan
gesture nested insideNative
gesture attached toScrollView
Gestures nested inside native elements such as
ScrollView
used to be able to steal pointers from their already active parents.That is no longer possible, already active parents cannot have their active pointers stolen.
Related to #2622
Test plan
EmptyExample.tsx
ScrollView
ScrollView
, drag thePan
gesturePan
gesture activated, and with this PR it doesn't anymoreNotes
Gesture.Simultaneous()
orsimultaneousWithExternalGesture()
Code
Collapsed code
```js import React from 'react'; import { StyleSheet, Text, View, ScrollView } from 'react-native'; import { Gesture, GestureDetector, GestureUpdateEvent, PanGestureHandlerEventPayload, } from 'react-native-gesture-handler'; import Animated, { SharedValue, useAnimatedStyle, useSharedValue, withSpring, } from 'react-native-reanimated'; export default function EmptyExample() { const firstExternalPosition = useSharedValue<{ x: number; y: number }>({ x: 0, y: 0, }); const secondExternalPosition = useSharedValue<{ x: number; y: number }>({ x: 0, y: 0, }); const nestedPosition = useSharedValue<{ x: number; y: number }>({ x: 0, y: 0, }); const setter = ( position: SharedValue<{ x: number; y: number; }> ) => { return (event: GestureUpdateEvent