requireExternalGestureToFail is not able to block a ScrollView
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript, react-native
- 领域
- mobile
调研方向
首先,使用报告中的 React Native 0.76.3 和 gesture-handler 2.20.2 设置,通过 Gesture.Native().requireExternalGestureToFail(pan) 在链接的 Snack 中重现 iOS 行为。跟踪此入口点背后的原生手势交互,并验证在识别 Pan 时 ScrollView 会被阻塞。
由索引模型根据 Issue 内容生成。
描述
Description
According to the docs, requireExternalGestureToFail is like the inverse of blocksExternalGesture.
However, I can't actually get requireExternalGestureToFail to do anything useful with a native gesture.
In particular, I want to block ScrollView if my Pan is being recognized.
The docs lead me to believe that this code would work:
import {View} from 'react-native'
import {
Gesture,
GestureDetector,
GestureHandlerRootView,
ScrollView,
} from 'react-native-gesture-handler'
export default function App() {
const pan = Gesture.Pan()
.onBegin(() => {
'worklet'
console.log('begin')
})
.onUpdate(() => {
'worklet'
console.log('update')
})
.onEnd(() => {
'worklet'
console.log('end')
})
.onFinalize(() => {
'worklet'
console.log('finalize')
})
return (
<GestureHandlerRootView>
<GestureDetector gesture={pan}>
<View style={{flex: 1, backgroundColor: 'blue'}}>
<ScrollViewExample pan={pan} />
</View>
</GestureDetector>
</GestureHandlerRootView>
)
}
function ScrollViewExample({pan}) {
const native = Gesture.Native().requireExternalGestureToFail(pan)
return (
<GestureDetector gesture={native}>
<ScrollView
horizontal
pagingEnabled
style={{
flex: 1,
backgroundColor: 'yellow',
}}>
<View
style={{
width: 200,
height: '100%',
backgroundColor: 'green',
}}
/>
<View
style={{
width: 200,
height: '100%',
backgroundColor: 'purple',
}}
/>
</ScrollView>
</GestureDetector>
)
}
But it doesn't do anything. The ScrollView is still in control of the gesture.
Steps to reproduce
- Drag the ScrollView
- The ScrollView gets dragged, but it should have been blocked by the Pan
https://github.com/user-attachments/assets/5950c53a-0f46-4060-83ac-6f414b87fe59
Snack or a link to a repository
https://snack.expo.dev/k1-MTyYfvD3wQNk3sr_je
Gesture Handler version
2.20.2
React Native version
0.76.3
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Expo bare workflow
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
Real device
Device model
No response
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 天内回复
-
[Web] A pan that starts on a Pressable presses it when the mouse button is released可能已有人在做 @mokshupadhyay 于 2 天前认领。 未关闭Platform: Web
难度 4/5 3-5 天 新手友好度 57/100
software-mansion/react-native-gesture-handler#4713 ·
维护者通常 2 天内回复
-
[iOS] Crash at app exit: static `_managers` map destroyed while `flushOperations` reads it可能已有人在做 @beqramo 于 6 天前认领。 未关闭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 于 6 天前认领。 未关闭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 于 8 天前认领。 未关闭Missing info Platform: iOS Platform: MacOS
难度 3/5 1-2 天 新手友好度 45/100
software-mansion/react-native-gesture-handler#4707 · 2 条评论 ·
维护者通常 2 天内回复
查看 software-mansion/react-native-gesture-handler 的全部 Issue
相似的 Issue
-
agentic-workflows
难度 1/5 1 小时以内 新手友好度 75/100
opencollective/opencollective-frontend#12789 ·
维护者通常 1 天内回复
-
Web download page shows a file as Completed when its download from S3 fails with an error response未关闭bug
难度 2/5 1-3 小时 新手友好度 77/100
awslabs/visual-asset-management-system#2097 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
openwatersio/slackwater#591 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
compiler-explorer/compiler-explorer#9738 ·
维护者通常 2 天内回复