[Android] `Touchable` doesn't call onPress when you tap on a` TextInput editable={false}` child
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- react-native, typescript
Research direction
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.
Written by the indexing model from the issue text.
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
- Dominant language
- TypeScript
- Stars
- 6.8k
- Forks
- 1.1k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 46
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from software-mansion/react-native-gesture-handler
-
[Jest][3.5.0] `fireEvent.press` no longer reaches `Touchable` when its child is inside an `InterceptingGestureDetector`Possibly taken @m-bert claimed this 3 days ago. OpenMissing info Platform: Web
Difficulty 3/5 1-2 days Newbie friendliness 72/100
software-mansion/react-native-gesture-handler#4689 · 4 comments ·
Maintainers usually reply within 2 days
-
[Web] GestureDetector blocks context menu by defaultPossibly taken @lassiecoder claimed this 4 days ago. OpenPlatform: Web
Difficulty 3/5 1-2 days Newbie friendliness 56/100
software-mansion/react-native-gesture-handler#4687 · 3 comments ·
Maintainers usually reply within 2 days
-
[Android] v3 `ReanimatedSwipeable` takes over a vertical scroll in a React Native list once the finger drifts 10 dp sidewaysMay be free again @JaydeepAgravat claimed this 10 days ago, and no pull request is open. OpenPlatform: Android
Difficulty 4/5 3-5 days Newbie friendliness 55/100
software-mansion/react-native-gesture-handler#4670 · 6 comments ·
Maintainers usually reply within 2 days
-
Jest: with the hook API, raw touch events fired under a `GestureDetector` don't reach ancestors under Testing Library 14May be free again @aliassar claimed this 13 days ago, and no pull request is open. OpenPlatform: Android Platform: iOS
Difficulty 3/5 1-2 days Newbie friendliness 66/100
software-mansion/react-native-gesture-handler#4656 · 1 comment ·
Maintainers usually reply within 2 days
-
[Android] A held tap on a Touchable or Pressable in ScrollView does nothing while the keyboard is upPossibly taken @m-bert claimed this 6 days ago. OpenMissing repro Platform: Android
Difficulty 4/5 3-5 days Newbie friendliness 50/100
software-mansion/react-native-gesture-handler#4653 · 7 comments ·
Maintainers usually reply within 2 days
All issues in software-mansion/react-native-gesture-handler
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 2 days
-
nip98: validateEvent skips the payload check for a string or bytes bodyMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nbd-wtf/nostr-tools#599 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LemmyNet/lemmy-ui#4442 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Zettlr/Zettlr#6664 · 1 comment ·
Maintainers usually reply within 1 day
-
Microsoft Outlook add attachment reads the binary field from item 0Possibly taken @joshbarros claimed this today. Openstatus:in-linear
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
n8n-io/n8n#44021 · 2 comments ·
Maintainers usually reply within 1 day