-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Description
The Pressable component in react-native-gesture-hander does not work on Android when the system screen reader, TalkBack, is enabled. This issue occurs with the latest version of React Native and the react-native-gesture-hander library, and is reproducible in the example app of this repo. The Pressable component can be focused on, but initiating a press or a long press with the screen reader does not fire the onPress, onLongPress, onPressIn or onPressOut functions. When I look at the resulting native view after layout in UI Inspector, I can see that the Pressable button does have both the "focusable" and "clickable" attributes set to true, which should make it tappable. In addition, the screen reader does announce that the Pressable can be tapped, due to "clickable" being true.
These issues do not occur with the Pressable component imported from react-native, so it does seem like a bug in RNGH. In practice this makes the Pressable from RNGH unusable on Android in apps that support the use of screen readers.
On iOS, with the VoiceOver screen reader enabled, both the React Native Pressable and the RNGH Pressable work as expected.
Steps to reproduce
- Install the basic-example demo app from this repository.
- Modify the
ComponentsScreen.tsxcode by adding the two new demo cases, ReactNativePressableDemo and RNGHPressableDemo from the Gist. - Install on physical Android device and Enable TalkBack.
- The React Native Pressable responds to presses, whereas the RNGH Pressable does not.
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
https://gist.github.com/olliFCA/7db728b0d7e3087e257cfdc3e70ee321
Gesture Handler version
2.30.0
React Native version
0.83.0
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
New Architecture (Fabric)
Build type
Debug mode
Device
Real device
Device model
Samsung Galaxy A55
Acknowledgements
Yes