Commit d933194
Dropping handlers when components are dropped (#3619)
## Description
Fixes #3608. On web, when gesture was active and its component had been
dropped, the gesture was not dropped. This caused conflicts with other
handlers, and prevented registering other gestures.
I added a method to drop handlers in the `GestureOchestrator` and call
it when component is dropped.
-->
## Test plan
```ts
import React from 'react';
import { useState } from 'react';
import { Pressable, TextInput } from 'react-native-gesture-handler';
export default function EmptyExample() {
const [shown, setShown] = useState(true)
if (!shown) {
return (
<Pressable
key="1"
testID="other-pressable"
style={{ width: 30, height: 30, backgroundColor: 'red' }}
onPress={() => console.log('pressed')}
/>
)
}
return (
<Pressable key="2" testID="bad-pressable" onPress={() => { }}>
<TextInput
style={{ backgroundColor: 'green', width: 100, height: 30 }}
onSubmitEditing={() => setShown(false)}
/>
</Pressable>
)
};
```1 parent fda19ef commit d933194
File tree
1 file changed
+1
-0
lines changed- packages/react-native-gesture-handler/src/web/handlers
1 file changed
+1
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
| 730 | + | |
730 | 731 | | |
731 | 732 | | |
732 | 733 | | |
| |||
0 commit comments