[iOS] Touch events fire on underlying views while UIActivityViewController (Share Sheet) is presented
还没有人认领这个 Issue。
- 主要语言
- C++
- 星标
- 127k
- 派生
- 25.3k
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 4
描述
Description
⚠️ Physical device only. This bug does not reproduce on the iOS Simulator.
On physical iOS devices, when Share.share() or ActionSheetIOS.showShareActionSheetWithOptions() presents a UIActivityViewController, tapping outside the share sheet to dismiss it also triggers touch events on the underlying RN views. For example, tapping above the share sheet to close it will fire onPress on anyPressable, TouchableOpacity, or other touch target at that screen position. In native iOS apps, this dismiss tap is consumed and does not reach the content underneath.
Real-world impact:
This bug is currently active in major production React Native apps on physical devices. For example, in Bluesky and Shop (by Shopify), if a user opens the iOS Share Sheet and taps the background to dismiss it, they can accidentally trigger background actions (like navigating, liking a post, or tapping a button).
Suspected root cause:
RN's touch system (RCTTouchHandler) processes events independently from UIKit's responder chain. When a native view controller is presented over the RN view hierarchy, UIKit knows not to deliver touches to the background — but RN's parallel touch system is unaware of the presentation and continues dispatching events.
I believe this same root cause affects other native iOS overlays outside the RN view hierarchy that rely on "touch outside" behavior to close, for example:
@expo/uiSwiftUI ContextMenu (https://github.com/expo/expo/issues/42068 — closed for lack of repro, but I've verified it on a physical device)- Zeego DropdownMenu (https://github.com/nandorojo/zeego/issues/91 — incorrectly closed as "native iOS behavior"; native apps like Mail don't have this problem)
Steps to reproduce
- Open the Snack on a physical iOS device (⚠️ this bug does NOT reproduce on Simulator — only real hardware)
- Tap "Share.share()" to open the share sheet
- Wait for the share sheet to fully present (~0.8 seconds)
- Tap any touch target in the upper portion of the screen (Pressable, TouchableOpacity, etc.)
- Expected: Touches blocked by the share sheet
- Actual: "Tapped" alert fires — touch passes through to the underlying view
React Native Version
0.84.1
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: macOS 26.2
CPU: (10) arm64 Apple M4
Memory: 161.16 MB / 32.00 GB
Shell:
version: 3.2.57
path: /bin/bash
Binaries:
Node:
version: 22.22.1
path: /Users/jaronheard/Library/Caches/fnm_multishells/33861_1774296117289/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 10.9.4
path: /Users/jaronheard/Library/Caches/fnm_multishells/33861_1774296117289/bin/npm
Watchman:
version: 2025.04.14.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/lib/ruby/gems/3.4.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.2
- iOS 26.2
- macOS 26.2
- tvOS 26.2
- visionOS 26.2
- watchOS 26.2
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode:
version: 26.3/17C529
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 3.4.2
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.1.0
wanted: 20.1.0
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.84.1
wanted: 0.84.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
N/A
MANDATORY Reproducer
https://snack.expo.dev/@jaronheard/da36c0
Screenshots and Videos
| Bluesky | Shop (Shopify) | Reproducer Snack |
|---|---|---|
| Tap passes through share sheet and navigates to Profile tab | Tap passes through share sheet and triggers the favorite/like button | Tap passes through share sheet and fires Pressable onPress alert |
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先在实体 iOS 设备上使用必需的 Snack reproducer,然后检查 RN 的 RCTTouchHandler 以及 issue 中描述的 share sheet 展示路径。当在 UIActivityViewController 外部点击将其关闭时,不再触发下层 Pressable 或 TouchableOpacity 视图上的触摸事件,即可视为完成;请在真实硬件上验证该行为,不要使用 Simulator。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- ios, react-native
- 领域
- mobile
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100