[Android] `Touchable` doesn't call onPress when you tap on a` TextInput editable={false}` child
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- react-native, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- TypeScript
- Star
- 6.8k
- Fork
- 1.1k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của software-mansion/react-native-gesture-handler
-
[Jest][3.5.0] `fireEvent.press` no longer reaches `Touchable` when its child is inside an `InterceptingGestureDetector`Có thể đã có người làm @m-bert đã nhận 3 ngày trước. Đang mởMissing info Platform: Web
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
software-mansion/react-native-gesture-handler#4689 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Web] GestureDetector blocks context menu by defaultCó thể đã có người làm @lassiecoder đã nhận 4 ngày trước. Đang mởPlatform: Web
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 56/100
software-mansion/react-native-gesture-handler#4687 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Android] v3 `ReanimatedSwipeable` takes over a vertical scroll in a React Native list once the finger drifts 10 dp sidewaysCó thể làm lại được @JaydeepAgravat đã nhận 10 ngày trước và không có pull request nào đang mở. Đang mởPlatform: Android
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
software-mansion/react-native-gesture-handler#4670 · 6 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Jest: with the hook API, raw touch events fired under a `GestureDetector` don't reach ancestors under Testing Library 14Có thể làm lại được @aliassar đã nhận 13 ngày trước và không có pull request nào đang mở. Đang mởPlatform: Android Platform: iOS
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 66/100
software-mansion/react-native-gesture-handler#4656 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Android] A held tap on a Touchable or Pressable in ScrollView does nothing while the keyboard is upCó thể đã có người làm @m-bert đã nhận 6 ngày trước. Đang mởMissing repro Platform: Android
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 50/100
software-mansion/react-native-gesture-handler#4653 · 7 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của software-mansion/react-native-gesture-handler
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
pollen-robotics/reachy-mini-desktop-app#341 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
mike-north/AgentMonitors#648 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Position: a popup placed again from between two layout steps lands a fraction of a pixel offĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/ui#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày