Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Android native buttons emitting 2 press events when talkbalk is e…
…nabled (#3002) ## Description When talkbalk accessability mode is enabled, pressing on any of the buttons provided by gesture handler (`BaseButton`, `RawButton`, `BorderlessButton`, Et Cetera) will cause 2 separate press events to go off. This PR fixes that invalid behaviour. Closes: #2808 ## Test plan - enable talkback mode - run the attached example - see how the button labeled `BaseButton` executes twice on `main` and a single time on this branch. ## Attached example ```js import React from 'react'; import { BaseButton } from 'react-native-gesture-handler'; import { Text, View, StyleSheet } from 'react-native'; const press = () => console.log('JS pressed'); const touch = () => console.log('JS touch'); export default function App() { return ( <View style={styles.root}> <BaseButton onPress={press}> <View accessible accessibilityRole="button" style={styles.button} onTouchStart={touch}> <Text>BaseButton</Text> </View> </BaseButton> </View> ); } const styles = StyleSheet.create({ root: { justifyContent: 'center', flex: 1, }, button: { width: 200, height: 100, margin: 20, backgroundColor: 'cyan', }, }); ``` ## Tests ### Normal behaviour (no talkback, no fix): ![image](https://github.com/user-attachments/assets/74912600-cd97-4347-aae5-8930228a725e) ### Before fix: ![image](https://github.com/user-attachments/assets/b0e1083a-d1ec-4ed6-ab57-7a1236f18ed2) ### With fix: ![image](https://github.com/user-attachments/assets/369c0b68-6c08-4d3b-8f04-5c9701bfd8ac)
- Loading branch information