[Android] `Touchable` doesn't call onPress when you tap on a` TextInput editable={false}` child
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- react-native, typescript
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 6.8k
- Forks
- 1.1k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 46
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de software-mansion/react-native-gesture-handler
-
[Jest][3.5.0] `fireEvent.press` no longer reaches `Touchable` when its child is inside an `InterceptingGestureDetector`Posiblemente ocupada @m-bert la tomó hace 3 días. AbiertoMissing info Platform: Web
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
software-mansion/react-native-gesture-handler#4689 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
[Web] GestureDetector blocks context menu by defaultPosiblemente ocupada @lassiecoder la tomó hace 4 días. AbiertoPlatform: Web
Dificultad 3/5 1-2 días Aptitud para principiantes 56/100
software-mansion/react-native-gesture-handler#4687 · 3 comentarios ·
Los mantenedores suelen responder en 2 días
-
[Android] v3 `ReanimatedSwipeable` takes over a vertical scroll in a React Native list once the finger drifts 10 dp sidewaysQuizá libre de nuevo @JaydeepAgravat la tomó hace 10 días y no hay ningún pull request abierto. AbiertoPlatform: Android
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
software-mansion/react-native-gesture-handler#4670 · 6 comentarios ·
Los mantenedores suelen responder en 2 días
-
Jest: with the hook API, raw touch events fired under a `GestureDetector` don't reach ancestors under Testing Library 14Quizá libre de nuevo @aliassar la tomó hace 13 días y no hay ningún pull request abierto. AbiertoPlatform: Android Platform: iOS
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
software-mansion/react-native-gesture-handler#4656 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[Android] A held tap on a Touchable or Pressable in ScrollView does nothing while the keyboard is upPosiblemente ocupada @m-bert la tomó hace 6 días. AbiertoMissing repro Platform: Android
Dificultad 4/5 3-5 días Aptitud para principiantes 50/100
software-mansion/react-native-gesture-handler#4653 · 7 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de software-mansion/react-native-gesture-handler
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
mike-north/AgentMonitors#648 ·
Los mantenedores suelen responder en 1 día
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
vercel-labs/ui#700 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días