[Android] `Touchable` doesn't call onPress when you tap on a` TextInput editable={false}` child
Les mainteneurs répondent en général sous 2 jours
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- react-native, typescript
Piste de recherche
Start by comparing RNGH Touchable and Pressable behavior with React Native's Pressable using the reproduction in the issue: a disabled TextInput inside each component on Android. Check the relevant gesture and touch handling entry points and existing tests for disabled TextInput children. Done when RNGH invokes onPress consistently with the intended Android behavior and the regression is covered by a test.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Description
Tapping a disabled TextInput doesn't trigger the onPress handler of its wrapping Touchable on Android.
The behaviour of RNGH's Touchable (and therefore Pressable) differs from the default React Native implementation. However, RN itself is inconsistent across iOS and Android, so the behaviour there also varies. Therefore, I'm not sure what is supposed to be the reference behaviour anymore, but what I can say is that it worked in RNGH v2.
| Android | iOS | Web | |
|---|---|---|---|
| RN | onPress is called |
onPress is not called |
onPress is called |
| RNGH | onPress is not called |
onPress is called 🤯 |
onPress is called |
AI explanation for the default behaviour on Android:
editable={false} becomes setEnabled(false) on the native EditText.
RN's Android hit-testing treats any disabled view as box-none: "Views that are disabled should never be the target of pointer events."
So the TextInput can't be the touch target, the parent Pressable becomes the target, and onPress fires.
AI explanation for the default behaviour on iOS:
editable={false} only turns off editing. The view can still be hit.
The touch lands on the TextInput. TextInput.js attaches its own usePressability handlers whatever editable is (it just skips focus() when non-editable, around line 599).
The TextInput therefore claims the responder, and the parent Pressable never gets it, so it logs nothing.
Steps to reproduce
import { Pressable, TextInput } from 'react-native'
import { Pressable as RNGHPressable, Touchable } from 'react-native-gesture-handler'
<View>
<Pressable onPress={() => Alert.alert('RN')}>
<TextInput editable={false} placeholder="tap here" />
</Pressable>
<RNGHPressable onPress={() => Alert.alert('RNGH Pressable')}>
<TextInput editable={false} placeholder="tap here" />
</RNGHPressable>
<Touchable onPress={() => Alert.alert('RNGH Touchable')}>
<TextInput editable={false} placeholder="tap here" />
</Touchable>
</View>
- Tap on the first Pressable - observe "RN" alert
- Tap on the secondPressable - observe no alert being shown
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
Gesture Handler version
3.4.0
React Native version
0.86.3
Platforms
Android
JavaScript runtime
None
Workflow
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
- Langage dominant
- TypeScript
- Étoiles
- 6.8k
- Forks
- 1.1k
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 46
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de software-mansion/react-native-gesture-handler
-
[Jest][3.5.0] `fireEvent.press` no longer reaches `Touchable` when its child is inside an `InterceptingGestureDetector`Peut-être pris @m-bert l’a pris il y a 3 jours. OuverteMissing info Platform: Web
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
software-mansion/react-native-gesture-handler#4689 · 4 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
[Web] GestureDetector blocks context menu by defaultPeut-être pris @lassiecoder l’a pris il y a 4 jours. OuvertePlatform: Web
Difficulté 3/5 1-2 jours Accessibilité débutants 56/100
software-mansion/react-native-gesture-handler#4687 · 3 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
[Android] v3 `ReanimatedSwipeable` takes over a vertical scroll in a React Native list once the finger drifts 10 dp sidewaysPeut-être à nouveau libre @JaydeepAgravat l’a pris il y a 10 jours, et aucune pull request n’est ouverte. OuvertePlatform: Android
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
software-mansion/react-native-gesture-handler#4670 · 6 commentaires ·
Les mainteneurs répondent en général sous 2 jours
-
Jest: with the hook API, raw touch events fired under a `GestureDetector` don't reach ancestors under Testing Library 14Peut-être à nouveau libre @aliassar l’a pris il y a 13 jours, et aucune pull request n’est ouverte. OuvertePlatform: Android Platform: iOS
Difficulté 3/5 1-2 jours Accessibilité débutants 66/100
software-mansion/react-native-gesture-handler#4656 · 1 commentaire ·
Les mainteneurs répondent en général sous 2 jours
-
[Android] A held tap on a Touchable or Pressable in ScrollView does nothing while the keyboard is upPeut-être pris @m-bert l’a pris il y a 6 jours. OuverteMissing repro Platform: Android
Difficulté 4/5 3-5 jours Accessibilité débutants 50/100
software-mansion/react-native-gesture-handler#4653 · 7 commentaires ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de software-mansion/react-native-gesture-handler
Issues similaires
-
Stop retrying permanent GitHub API failures in retry.shPeut-être pris @muspi-merol-review l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
promplate/code-review#113 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
ix-toast (5.3): the status icon has `role="img"` and no accessible name (axe `role-img-alt`)Ouvertetriage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
サムネイルの Storage のバケット(`thumbnails`)に、大きさの上限(1 MiB)と許可する種類(JPEG、PNG、WebP)を設定するPeut-être pris @ykzts l’a pris aujourd’hui. Ouvertetech: supabase
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
inabagumi/shinju-date#7147 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
elecnix/your-attention#129 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
umami-software/umami#4780 ·
Les mainteneurs répondent en général sous 3 jours