[Web] A pan that starts on a Pressable presses it when the mouse button is released
维护者通常 2 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 57/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- react-native, typescript
- 领域
- frontend, mobile-dev
调研方向
Start with GestureHandlerWebDelegate.onActivate and PointerEventManager.pointerDownCallback, then check how cancelsJSResponder is documented and handled on Android and iOS. The reproduction repository shows the failing behavior and expected click behavior. Done when dragging from a Pressable or SVG shape pans without pressing it, while a click without a drag still presses.
由索引模型根据 Issue 内容生成。
描述
Description
On Android and iOS, a gesture that activates cancels React Native's JS responder (cancelsJSResponder, true by default), so a drag that starts on a Pressable, or on a react-native-svg shape with onPress, only pans. On web the same drag pans, and then the element it started on is pressed when the mouse button is released.
I expected web to match Android and iOS: a drag that activates the pan presses nothing, while a click without a drag still presses.
As far as I can tell, on web a React Native press is the DOM's click: react-native-web's PressResponder calls onPress from onClick, and react-native-svg maps onPress to onClick. The browser fires click because the button went down and up on the same element: pointerDownCallback in PointerEventManager captures the pointer on the pressed element, and the pan carries that element along under the pointer anyway. cancelsJSResponder is accepted on web but never read: GestureHandlerWebDelegate.onActivate only sets the cursor, and nothing stops the click that ends the pointer sequence. Its documentation lists Android and iOS only.
One way to match the native platforms: when a handler with cancelsJSResponder activates, stop the click that ends that pointer sequence with a capture-phase listener on its view, as d3-drag does after a drag. A listener like that in the reproduction, set from the pan's onActivate, removes both presses, and a click without a drag still presses.
Steps to reproduce
- Clone the repository below, run
npm installand thennpx expo start --web, and open the page in Chrome. - With a mouse, press the gray square (a react-native-svg
RectwithonPress), drag about 100 px, and release. - Do the same with the blue square (a
Pressable). - The line above the squares reads "Pans: 2 · Rect presses: 1 · Pressable presses: 1": each drag panned and then pressed the square it started on.
- For comparison, run
npx expo run:androidand swipe from each square: the pan count goes up and neither press count does. A tap on either square presses it on both platforms.
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
https://github.com/miniware9/react-native-gesture-handler-web-press-after-pan
Gesture Handler version
3.3.0 (also reproduced with 3.5.0 on web)
React Native version
0.88.1
Platforms
Web
JavaScript runtime
V8
Workflow
Using Expo Prebuild or an Expo development build
Build type
Debug mode
Device
Real device
Device model
Chrome 157 on Debian 13, with a mouse; compared with a Pixel 9a emulator on Android 17
Acknowledgements
Yes
- 主要语言
- TypeScript
- 星标
- 6.8k
- 派生
- 1.1k
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 28
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
software-mansion/react-native-gesture-handler 的其他 Issue
-
Missing repro Platform: Android Platform: iOS
难度 5/5 一周以上 新手友好度 39/100
software-mansion/react-native-gesture-handler#4714 · 1 条评论 ·
维护者通常 2 天内回复
-
[iOS] Crash at app exit: static `_managers` map destroyed while `flushOperations` reads it可能已有人在做 @beqramo 于 5 天前认领。 未关闭Missing info Missing repro Platform: iOS Platform: MacOS
难度 2/5 1-3 小时 新手友好度 30/100
software-mansion/react-native-gesture-handler#4711 · 3 条评论 ·
维护者通常 2 天内回复
-
[iOS][Fabric] Recognizer of a live handler stays on a recycled view and takes every drag on the component that reuses it可能已有人在做 @nihar777 于 5 天前认领。 未关闭Platform: iOS
难度 4/5 3-5 天 新手友好度 35/100
software-mansion/react-native-gesture-handler#4710 · 2 条评论 ·
维护者通常 2 天内回复
-
[iOS] Button press feedback invisible on quick taps when Reduce Motion is enabled可能已有人在做 @andreialecu 于 7 天前认领。 未关闭Missing info Platform: iOS Platform: MacOS
难度 3/5 1-2 天 新手友好度 45/100
software-mansion/react-native-gesture-handler#4707 · 2 条评论 ·
维护者通常 2 天内回复
-
Missing info Platform: Android
难度 4/5 3-5 天 新手友好度 22/100
software-mansion/react-native-gesture-handler#4706 · 1 条评论 ·
维护者通常 2 天内回复
查看 software-mansion/react-native-gesture-handler 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
ehmpathy/rhachet-roles-bhrain#878 ·
维护者通常 1 天内回复
-
Chat UI: Message actions dropdown is cut off beneath composer when message is near bottom of chat可能已有人在做 @koeria 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
milind-soni/OpenMausBot#8023 ·
维护者通常 1 天内回复
-
Windows microphone listing treats words in a device name as DirectShow labels可能已有人在做 @Sujal-chaudhary 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 88/100
clipy-recorder/clipy#447 · 2 条评论 ·
维护者通常 1 天内回复
-
enhancement from-app needs-triage
难度 2/5 1-3 小时 新手友好度 68/100
nightly-labs/openbot#19162 ·
维护者通常 1 天内回复
-
triage:in-progress
难度 2/5 1-3 小时 新手友好度 76/100
Cotal-AI/Cotal#11229 · 1 条评论 ·
维护者通常 1 天内回复