lodev09/react-native-true-sheet

App Crashes on IOS

Closed this issue · 1 comments

My app keeps crashing on IOS from time tot time while trying to present a sheet, this is the error:

Your app just crashed. See the error below.
NSInvalidArgumentException: Application tried to present modally a view controller <TrueSheet.TrueSheetViewController: 0x7fd65e5e21e0> that is already being presented by <UIViewController: 0x7fd67d3bce70>.
0 CoreFoundation 0x00007ff80045478b __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007ff80004db73 objc_exception_throw + 48
2 UIKitCore 0x000000011de901ac -[UIViewController _presentViewController:withAnimationController:completion:] + 5648
3 UIKitCore 0x000000011de90c14 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 98
4 UIKitCore 0x000000011deac46a -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] + 297
5 UIKitCore 0x000000011dea8764 -[_UIViewControllerTransitionContext _runAlongsideCompletions] + 126
6 UIKitCore 0x000000011dea84f8 -[_UIViewControllerTransitionContext completeTransition:] + 117
7 UIKitCore 0x000000011ed79d8b -[UITransitionView notifyDidCompleteTransition:] + 244
8 UIKitCore 0x000000011ed79a2a -[UITransitionView _didCompleteTransition:] + 1395
9 UIKit 0x0000000113dc90b8 -[UITransitionViewAccessibility _didCompleteTransition:] + 41
10 UIKitCore 0x000000011edb4458 UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK + 15
11 UIKitCore 0x000000011edb4777 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 797
12 UIKitCore 0x000000011ed843b2 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 190
13 UIKitCore 0x000000011ed849bf -[UIViewAnimationState animationDidStop:finished:] + 263
14 UIKit 0x0000000113dd4c9d -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 195
15 UIKitCore 0x000000011ed84b40 -[UIViewAnimationState animationDidStop:finished:] + 648
16 UIKit 0x0000000113dd4c9d -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 195
17 QuartzCore 0x00007ff80881d9a2 _ZN2CA5Layer23run_animation_callbacksEPv + 308
18 libdispatch.dylib 0x00007ff80013d0d9 _dispatch_client_callout + 8
19 libdispatch.dylib 0x00007ff80014cb86 _dispatch_main_queue_drain + 1330
20 libdispatch.dylib 0x00007ff80014c646 _dispatch_main_queue_callback_4CF + 31
21 CoreFoundation 0x00007ff8003b26cc CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
22 CoreFoundation 0x00007ff8003acfbe __CFRunLoopRun + 2429
23 CoreFoundation 0x00007ff8003ac264 CFRunLoopRunSpecific + 560
24 GraphicsServices 0x00007ff809b4024e GSEventRunModal + 139
25 UIKitCore 0x000000011e7867bf -[UIApplication _run] + 994
26 UIKitCore 0x000000011e78b5de UIApplicationMain + 123
27 MyChange 0x000000010b2a11e0 main + 96
28 dyld 0x0000000113b02384 start_sim + 10
29 ??? 0x00000001225ba386 0x0 + 4871398278

Please follow this guide or this

Make sure you're dismissing any presented sheet before presenting a new one. Or define it inside. For react-navigation, you need to dismiss it before navigating.