[v7][iOS] Crash when closing react-native's modal when presentationStyle is pageSheet
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- ios, react-native
- 领域
- mobile-dev
调研方向
从可复现的演示开始,在 ModalScreen.tsx 中添加 presentationStyle="pageSheet",然后复现滑动关闭时的崩溃。阅读 RNNEventEmitter.m、RNNModalManagerEventHandler.m 和 RNNModalManager.m 中的堆栈跟踪位置,尤其是 modal-attempted-dismiss 事件路径。完成的标准是 modal 可以通过关闭手势关闭而不会崩溃,同时基于状态的关闭仍然有效。
由索引模型根据 Issue 内容生成。
描述
🐛 Bug Report
When using react native's Modal component with presentationStyle="pageSheet" the modal does show and hide, however, when hiding the modal using the "closing gesture" (dragging the view down) the app will crash. If closed through the state change, this does not happen.
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
Check out the repo in the "Reproducible Demo" section, or clone the playground application, and simply add presentationStyle="pageSheet" to the modal located in ModalScreen.tsx and try closing the modal by dragging the screen down.
...
{Platform.OS === 'ios' && (
<Modal
visible={this.state.modalVisible}
presentationStyle="pageSheet" // <--- add this
onShow={() => console.log('===> YES, THIS IS THE CORRECT MODAL, NOW TRY TO DISMISS IT USING SWIPE GESTURE ;)')}
onRequestClose={() => this.setState({ modalVisible: false })}
>
...
In order to trigger this view just press Navigation in the bottom tab, then navigate to Modal or PageSheet modal, finally press "Toggle declared modal" to trigger the default modal.
Expected behavior
Expected the modal would close the same way as when changing the state.
Actual Behavior
Somehow the application crashes, apparently the RRN's modal events get called. Here's the crash dump:
CoreSimulator 783.5 - Device: iPhone 12 mini (********-****-****-****-************) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 12 mini
terminating with uncaught exception of type NSException
dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
abort() called
Last Exception Backtrace:
0 CoreFoundation 0x7fff203feb94 __exceptionPreprocess + 226
1 libobjc.A.dylib 0x7fff201a1be7 objc_exception_throw + 48
2 CoreFoundation 0x7fff2047ef64 _CFThrowFormattedException + 194
3 CoreFoundation 0x7fff2048945a -[__NSPlaceholderDictionary initWithCapacity:].cold.1 + 0
4 CoreFoundation 0x7fff2046c940 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 251
5 CoreFoundation 0x7fff203fd82b +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
6 myapp 0x10c648747 -[RNNEventEmitter sendModalAttemptedToDismissEvent:] + 119 (RNNEventEmitter.m:135)
7 myapp 0x10c6522d1 -[RNNModalManagerEventHandler attemptedToDismissModal:] + 161 (RNNModalManagerEventHandler.m:21)
8 myapp 0x10c651bd5 -[RNNModalManager presentationControllerDidAttemptToDismiss:] + 133 (RNNModalManager.m:184)
9 UIKitCore 0x7fff24771683 -[UIPresentationController _sendDidAttemptToDismiss] + 119
10 UIKitCore 0x7fff253465f4 __66-[UISheetPresentationController sheetInteraction:didChangeOffset:]_block_invoke.906 + 34
11 libdispatch.dylib 0x7fff2011265a _dispatch_call_block_and_release + 12
12 libdispatch.dylib 0x7fff2011383a _dispatch_client_callout + 8
13 libdispatch.dylib 0x7fff20120c88 _dispatch_main_queue_callback_4CF + 1075
14 CoreFoundation 0x7fff2036c84d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
15 CoreFoundation 0x7fff203670aa __CFRunLoopRun + 2772
16 CoreFoundation 0x7fff203660f3 CFRunLoopRunSpecific + 567
17 GraphicsServices 0x7fff2c995cd3 GSEventRunModal + 139
18 UIKitCore 0x7fff25059f42 -[UIApplication _run] + 928
19 UIKitCore 0x7fff2505eb5e UIApplicationMain + 101
20 myapp 0x10b898fc8 main + 104 (main.m:7)
21 dyld_sim 0x1102d7ee9 start_sim + 10
22 dyld 0x1193ed4fe start + 462
Your Environment
- React Native Navigation version: 7.25.4
- React Native version: 0.67.2
- Platform(s) (iOS, Android, or both?): iOS
- Device info (Simulator/Device? OS version? Debug/Release?): iOS 15.2
Reproducible Demo
https://github.com/randomBrainstormer/RnnBugExample2
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, and I know how to start.
- ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
- ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
- 主要语言
- MDX
- 星标
- 13.2k
- 派生
- 2.6k
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wix/react-native-navigation 的其他 Issue
-
needs triage triage: documentation
难度 2/5 1-3 小时 新手友好度 68/100
wix/react-native-navigation#8343 · 1 条评论 ·
-
[Fix] searchBar `focus:` true ignored on mergeOptions when searchController already exists可能已有人在做 @IsaacIsrael 于 159 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
wix/react-native-navigation#8318 ·
-
needs triage type: accepted/bug
难度 4/5 3-5 天 新手友好度 25/100
wix/react-native-navigation#8365 · 2 条评论 ·
-
`showOverlay` creates a scene-less `UIWindow`, so overlays never appear under UIScene lifecycle可能已有人在做 @yedidyak 于 4 天前认领。 未关闭platform: iOS type: accepted/bug
难度 3/5 1-2 天 新手友好度 68/100
wix/react-native-navigation#8345 · 2 条评论 · 2 个 reaction ·
-
platform: iOS type: accepted/bug
难度 4/5 3-5 天 新手友好度 48/100
wix/react-native-navigation#8340 ·
查看 wix/react-native-navigation 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
firebase/flutterfire#18918 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
customerio/customerio-flutter#441 ·
维护者通常 2 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
jhomlala/betterplayer#1646 ·
维护者通常 1 天内回复