[v7][iOS] Crash when closing react-native's modal when presentationStyle is pageSheet

Đang mở
#7,461 4 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
ios, react-native
Lĩnh vực
mobile-dev

Hướng nghiên cứu

Bắt đầu với bản demo có thể tái hiện và thêm presentationStyle="pageSheet" vào ModalScreen.tsx, sau đó tái hiện lỗi crash khi vuốt để đóng. Đọc các vị trí trong stack trace ở RNNEventEmitter.m, RNNModalManagerEventHandler.m và RNNModalManager.m, đặc biệt là đường đi của sự kiện modal-attempted-dismiss. Được xem là hoàn tất khi modal có thể được đóng bằng cử chỉ đóng mà không bị crash, trong khi việc đóng dựa trên state vẫn hoạt động.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs triage triage: bug

🐛 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.
Ngôn ngữ chính
MDX
Star
13.2k
Fork
2.6k
Merge trung bình
2 ngày 10 giờ
Pull request đã merge (30 ngày)
6

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wix/react-native-navigation

Tất cả issue của wix/react-native-navigation

Issue tương tự

Thêm issue về Mobile Dev

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.