-
-
Notifications
You must be signed in to change notification settings - Fork 980
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cancelling manual activation gestures blocking interactivity on i…
…OS (#3007) ## Description Having a `gesture` with `manualActivation` set to `true` freezes interactions globally when such gesture gets cancelled. If a touch or palm cancellation is triggered by the device, all touchable elements, both the native and the gesturized ones in the app become disabled. This state is fixed when the cancelled gesture is triggered again. closes #2885 ## Test plan Using the attached example on iOS iPad, perform the following sequence: - tap the `OUTSIDE PRESSABLE` - see how it turns red - press the grey area with an entire palm so that a cancellation notification dispatches to the console - now try tapping the `OUTSIDE PRESSABLE` yet again - on the `main` branch, you will see no red indicator, on this branch you should see one, which is the intended behaviour ## Code: ```js import React from 'react-native'; import { TouchableHighlight, View, Text, StyleSheet } from 'react-native'; import { Gesture, GestureHandlerRootView, GestureDetector, } from 'react-native-gesture-handler'; export default function EmptyExample() { const pan = Gesture.Pinch() .manualActivation(true) .onTouchesDown((event) => { console.log('down', event); }) .onTouchesCancelled((event) => { console.log('cancelled', event); }) .onStart(() => console.log('started')); return ( <GestureHandlerRootView style={exampleStyles.root}> <TouchableHighlight onPress={() => console.log(2)} underlayColor={'red'} style={[exampleStyles.button, { backgroundColor: '#21da1a' }]}> <Text>OUTSIDE DETECTOR</Text> </TouchableHighlight> <GestureDetector gesture={pan}> <View style={[exampleStyles.area, { backgroundColor: '#5e5e5e' }]}> <TouchableHighlight onPress={() => console.log(1)} underlayColor={'red'} style={[exampleStyles.button, { backgroundColor: '#dad41a' }]}> <Text>INSIDE DETECTOR</Text> </TouchableHighlight> </View> </GestureDetector> </GestureHandlerRootView> ); } const exampleStyles = StyleSheet.create({ root: { flex: 1, }, area: { flex: 1, marginTop: 100 }, button: { width: 100, height: 100, zIndex: 100, position: 'absolute', }, }); ```
- Loading branch information
Showing
8 changed files
with
8 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters