Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on iOS with React Navigation when changing screens behind modal #1678

Open
huschu opened this issue Jan 9, 2023 · 13 comments · May be fixed by #1704
Open

Crash on iOS with React Navigation when changing screens behind modal #1678

huschu opened this issue Jan 9, 2023 · 13 comments · May be fixed by #1704
Assignees
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@huschu
Copy link

huschu commented Jan 9, 2023

Description

I'm not 100% certain this is a react native screens issue, it might be a react navigation issue as well. I created the issue here because rns showed up in the crash report. But I couldn't really figure out what happened. I provided a minimal example in snack that also crashes.

The crash happens when screens behind a modal are changed (like in the rn auth example) and only on iOS, Android works fine.

crash report ------------------------------------- Translated Report (Full Report Below) -------------------------------------

Version: 0.0.0 (1)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd_sim [6225]
Coalition: com.apple.CoreSimulator.SimDevice.3C6E362A-E986-499A-9737-84A8454865AD [1368]
Responsible Process: SimulatorTrampoline [898]

Date/Time: 2023-01-09 16:50:46.5363 +0100
Launch Time: 2023-01-09 14:55:19.6150 +0100
OS Version: macOS 12.6.1 (21G217)
Release Type: User
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016aa07fe0
Exception Codes: 0x0000000000000002, 0x000000016aa07fe0
VM Region Info: 0x16aa07fe0 is in 0x167204000-0x16aa08000; bytes after start: 58736608 bytes before end: 31
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
CoreAnimation 166e90000-167180000 [ 3008K] rw-/rwx SM=PRV
GAP OF 0x84000 BYTES
---> STACK GUARD 167204000-16aa08000 [ 56.0M] ---/rwx SM=NUL ... for thread 0
Stack 16aa08000-16b204000 [ 8176K] rw-/rwx SM=PRV thread 0
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [6386]

Triggered by Thread: 0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 CoreFoundation 0x1802fcb84 -[__NSArrayM count] + 0
1 UIKitCore 0x10cd09270 -[UIViewController(UIContainerViewControllerProtectedMethods) childViewControllers] + 32
2 myapp 0x104e8ef20 -[RNSScreen findChildVCForConfigAndTrait:includingModals:] + 52 (RNSScreen.mm:947)
3 myapp 0x104e8f030 -[RNSScreen findChildVCForConfigAndTrait:includingModals:] + 324 (RNSScreen.mm:957)
4 myapp 0x104e8f030 -[RNSScreen findChildVCForConfigAndTrait:includingModals:] + 324 (RNSScreen.mm:957)
[...]
510 myapp 0x104e8f030 -[RNSScreen findChildVCForConfigAndTrait:includingModals:] + 324 (RNSScreen.mm:957)

Thread 1:: com.apple.uikit.eventfetch-thread
0 libsystem_kernel.dylib 0x1af1fdfcc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1af1fe430 mach_msg + 72
2 CoreFoundation 0x180372a18 __CFRunLoopServiceMachPort + 156
3 CoreFoundation 0x18036d08c __CFRunLoopRun + 1152
4 CoreFoundation 0x18036c7f4 CFRunLoopRunSpecific + 584
5 Foundation 0x180bcf0c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
6 Foundation 0x180bcf2ec -[NSRunLoop(NSRunLoop) runUntilDate:] + 60
7 UIKitCore 0x10d4136e0 -[UIEventFetcher threadMain] + 424
8 Foundation 0x180bf4aac NSThread__start + 704
9 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
10 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 2:: com.squareup.SocketRocket.NetworkThread
0 libsystem_kernel.dylib 0x1af1fdfcc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1af1fe430 mach_msg + 72
2 CoreFoundation 0x180372a18 __CFRunLoopServiceMachPort + 156
3 CoreFoundation 0x18036d08c __CFRunLoopRun + 1152
4 CoreFoundation 0x18036c7f4 CFRunLoopRunSpecific + 584
5 Foundation 0x180bcf0c8 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 208
6 myapp 0x104fb0ae0 -[_RCTSRRunLoopThread main] + 336 (RCTSRWebSocket.m:1624)
7 Foundation 0x180bf4aac NSThread__start + 704
8 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
9 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 3:: com.apple.NSURLConnectionLoader
0 libsystem_kernel.dylib 0x1af1fdfcc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1af1fe430 mach_msg + 72
2 CoreFoundation 0x180372a18 __CFRunLoopServiceMachPort + 156
3 CoreFoundation 0x18036d08c __CFRunLoopRun + 1152
4 CoreFoundation 0x18036c7f4 CFRunLoopRunSpecific + 584
5 CFNetwork 0x184001ae8 0x183df2000 + 2161384
6 Foundation 0x180bf4aac NSThread__start + 704
7 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
8 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 4:: com.apple.CFSocket.private
0 libsystem_kernel.dylib 0x1af208550 __select + 8
1 CoreFoundation 0x180387a54 __CFSocketManager + 612
2 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
3 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 5:: com.apple.CFStream.LegacyThread
0 libsystem_kernel.dylib 0x1af1fdfcc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1af1fe430 mach_msg + 72
2 CoreFoundation 0x180372a18 __CFRunLoopServiceMachPort + 156
3 CoreFoundation 0x18036d08c __CFRunLoopRun + 1152
4 CoreFoundation 0x18036c7f4 CFRunLoopRunSpecific + 584
5 CoreFoundation 0x1803966bc _legacyStreamRunLoop_workThread + 260
6 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
7 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 6:: com.facebook.react.JavaScript
0 libsystem_kernel.dylib 0x1af1fdfcc mach_msg_trap + 8
1 libsystem_kernel.dylib 0x1af1fe430 mach_msg + 72
2 CoreFoundation 0x180372a18 __CFRunLoopServiceMachPort + 156
3 CoreFoundation 0x18036d08c __CFRunLoopRun + 1152
4 CoreFoundation 0x18036c7f4 CFRunLoopRunSpecific + 584
5 myapp 0x104efe12c +[RCTCxxBridge runRunLoop] + 736 (RCTCxxBridge.mm:335)
6 Foundation 0x180bf4aac NSThread__start + 704
7 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
8 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 7:: hades
0 libsystem_kernel.dylib 0x1af201694 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1af258c88 _pthread_cond_wait + 1224
2 libc++.1.dylib 0x180278920 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 24
3 hermes 0x1088433c0 0x108728000 + 1160128
4 hermes 0x108843174 0x108728000 + 1159540
5 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
6 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 8:: hermes-chrome-inspector-conn
0 libsystem_kernel.dylib 0x1af201694 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1af258c88 _pthread_cond_wait + 1224
2 libc++.1.dylib 0x180278920 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 24
3 myapp 0x10523fdbc void std::__1::condition_variable::waitfacebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1(std::__1::unique_lockstd::__1::mutex&, facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1) + 64 (__mutex_base:404)
4 myapp 0x10523fbd8 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 112 (SerialExecutor.cpp:41)
5 myapp 0x105242908 facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0::operator()() const + 28 (SerialExecutor.cpp:16)
6 myapp 0x1052428cc decltype(static_cast<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(fp)()) std::__1::__invoke<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&) + 24 (type_traits:3918)
7 myapp 0x105242884 void std::__1::__invoke_void_return_wrapper<void, true>::__call<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&) + 28 (invoke.h:61)
8 myapp 0x10524285c std::__1::__function::__alloc_func<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0, std::__1::allocator<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0>, void ()>::operator()() + 28 (function.h:178)
9 myapp 0x1052412d8 std::__1::__function::__func<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0, std::__1::allocator<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0>, void ()>::operator()() + 28 (function.h:352)
10 myapp 0x104f15cf8 std::__1::__function::__value_func<void ()>::operator()() const + 60 (function.h:505)
11 myapp 0x104f15cb0 std::__1::function<void ()>::operator()() const + 24 (function.h:1182)
12 myapp 0x10513baa4 facebook::hermes::inspector::detail::Thread::run(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>) + 32 (Thread.h:73)
13 myapp 0x10513c950 decltype(static_cast<void (>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::__invoke<void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> >(void (&&)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&&, std::__1::function<void ()>&&) + 100 (type_traits:3918)
14 myapp 0x10513c8a0 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void (
)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>, 2ul, 3ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> >&, std::__1::__tuple_indices<2ul, 3ul>) + 76 (thread:287)
15 myapp 0x10513bf50 void
std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> > >(void) + 84 (thread:298)
16 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
17 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 9:: hermes-inspector
0 libsystem_kernel.dylib 0x1af201694 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1af258c88 _pthread_cond_wait + 1224
2 libc++.1.dylib 0x180278920 std::__1::condition_variable::wait(std::__1::unique_lockstd::__1::mutex&) + 24
3 myapp 0x10523fdbc void std::__1::condition_variable::waitfacebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1(std::__1::unique_lockstd::__1::mutex&, facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1) + 64 (__mutex_base:404)
4 myapp 0x10523fbd8 facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 112 (SerialExecutor.cpp:41)
5 myapp 0x105242908 facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0::operator()() const + 28 (SerialExecutor.cpp:16)
6 myapp 0x1052428cc decltype(static_cast<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(fp)()) std::__1::__invoke<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&) + 24 (type_traits:3918)
7 myapp 0x105242884 void std::__1::__invoke_void_return_wrapper<void, true>::__call<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&>(facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0&) + 28 (invoke.h:61)
8 myapp 0x10524285c std::__1::__function::__alloc_func<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0, std::__1::allocator<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0>, void ()>::operator()() + 28 (function.h:178)
9 myapp 0x1052412d8 std::__1::__function::__func<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0, std::__1::allocator<facebook::hermes::inspector::detail::SerialExecutor::SerialExecutor(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)::$_0>, void ()>::operator()() + 28 (function.h:352)
10 myapp 0x104f15cf8 std::__1::__function::__value_func<void ()>::operator()() const + 60 (function.h:505)
11 myapp 0x104f15cb0 std::__1::function<void ()>::operator()() const + 24 (function.h:1182)
12 myapp 0x10513baa4 facebook::hermes::inspector::detail::Thread::run(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>) + 32 (Thread.h:73)
13 myapp 0x10513c950 decltype(static_cast<void (>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::__invoke<void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> >(void (&&)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&&, std::__1::function<void ()>&&) + 100 (type_traits:3918)
14 myapp 0x10513c8a0 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void (
)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>, 2ul, 3ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> >&, std::__1::__tuple_indices<2ul, 3ul>) + 76 (thread:287)
15 myapp 0x10513bf50 void
std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct >, void ()(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()>), std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void ()> > >(void) + 84 (thread:298)
16 libsystem_pthread.dylib 0x1af2586c8 _pthread_start + 116
17 libsystem_pthread.dylib 0x1af253910 thread_start + 8

Thread 10:: Dispatch queue: com.apple.libtrace.state.block-list
0 libsystem_kernel.dylib 0x1af1ffdd4 __ulock_wait + 8
1 libdispatch.dylib 0x18013605c _dlock_wait + 52
2 libdispatch.dylib 0x180135e0c _dispatch_thread_event_wait_slow + 52
3 libdispatch.dylib 0x180146218 DISPATCH_WAIT_FOR_QUEUE + 392
4 libdispatch.dylib 0x180145d18 _dispatch_sync_f_slow + 160
5 libsystem_trace.dylib 0x180075638 ___os_state_request_for_self_block_invoke + 348
6 libdispatch.dylib 0x180133fa4 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x180135768 _dispatch_client_callout + 16
8 libdispatch.dylib 0x18013d7f8 _dispatch_lane_serial_drain + 780
9 libdispatch.dylib 0x18013e474 _dispatch_lane_invoke + 448
10 libdispatch.dylib 0x18014a624 _dispatch_workloop_worker_thread + 772
11 libsystem_pthread.dylib 0x1af254b40 _pthread_wqthread + 284
12 libsystem_pthread.dylib 0x1af253904 start_wqthread + 8

Thread 11:
0 libsystem_pthread.dylib 0x1af2538fc start_wqthread + 0

Thread 12:
0 libsystem_pthread.dylib 0x1af2538fc start_wqthread + 0

Thread 13:
0 libsystem_pthread.dylib 0x1af2538fc start_wqthread + 0

Thread 14:
0 libsystem_pthread.dylib 0x1af2538fc start_wqthread + 0

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000600000eaaf10 x1: 0x00000001b033e4b6 x2: 0x0000000000000004 x3: 0x0000000000000001
x4: 0x0000000000000003 x5: 0x0000000000000000 x6: 0x0000600001a25b00 x7: 0x0000000000000000
x8: 0x000000010e323000 x9: 0x00000001b033e4b6 x10: 0x000000011e8e9a00 x11: 0x000000000000007f
x12: 0x0000000000000036 x13: 0x000000011e8e9d40 x14: 0x01000001b793a9c9 x15: 0x00000001b793a9c8
x16: 0x00000001b793a9c8 x17: 0x00000001802fcb84 x18: 0x0000000000000000 x19: 0x0000000133dfb960
x20: 0x00000000000001b8 x21: 0x0000000000000000 x22: 0x0000000116e0c9e0 x23: 0x0000000117104bd0
x24: 0x0000000116e0c9e0 x25: 0x0000000133b114f0 x26: 0x00006000002a5980 x27: 0x0000600000f4a070
x28: 0x0000000000000001 fp: 0x000000016aa08010 lr: 0x000000010cd09270
sp: 0x000000016aa08000 pc: 0x00000001802fcb84 cpsr: 0x60001000
far: 0x000000016aa07fe0 esr: 0x92000047 (Data Abort) byte write Translation fault

Binary Images:
0x1802ed000 - 0x180699fff com.apple.CoreFoundation (6.9) /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x10c90c000 - 0x10dfb7fff com.apple.UIKitCore (1.0) /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x104bfc000 - 0x10565ffff com.myapp.development (0.0.0) <1dc2cb15-ac62-3f64-bd62-68d203d8ed8b> /Users/USER/Library/Developer/CoreSimulator/Devices/3C6E362A-E986-499A-9737-84A8454865AD/data/Containers/Bundle/Application/1F2614F2-4314-47B3-81F2-29117398E98B/myapp.app/myapp
0x1af1fd000 - 0x1af232ffb libsystem_kernel.dylib () <6cfb89a3-4d8e-3da3-96ef-7d847d09cab1> /usr/lib/system/libsystem_kernel.dylib
0x180710000 - 0x180fc4fff com.apple.Foundation (6.9) <532aae62-f6cf-3de2-8988-170389a83ad5> /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation
0x1af251000 - 0x1af25dffb libsystem_pthread.dylib (
) <6de4a53b-8d96-3c92-b3c9-4a5ed84776fb> /usr/lib/system/libsystem_pthread.dylib
0x183df2000 - 0x184175fff com.apple.CFNetwork (1399) /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x18026c000 - 0x1802c7ffb libc++.1.dylib () <0f7cacf5-28e6-356c-95d2-6caab944290b> /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libc++.1.dylib
0x108728000 - 0x1089f3fff dev.hermesengine.iphonesimulator (0.11.0) <31dc8b0d-5ef8-3d86-944b-b7b00b2e93dc> /Users/USER/Library/Developer/CoreSimulator/Devices/3C6E362A-E986-499A-9737-84A8454865AD/data/Containers/Bundle/Application/1F2614F2-4314-47B3-81F2-29117398E98B/myapp.app/Frameworks/hermes.framework/hermes
0x180132000 - 0x180178fff libdispatch.dylib (
) <2cd267ae-adf6-3f56-897a-04baff62b34f> /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdispatch.dylib
0x180061000 - 0x180078fff libsystem_trace.dylib () <81029b42-ad41-3973-98ff-613787d86da4> /Applications/Xcode-14.1.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_trace.dylib
0x0 - 0xffffffffffffffff ??? (
) <00000000-0000-0000-0000-000000000000> ???

EOF

Steps to reproduce

  1. Open a modal
  2. Change the screens behind the modal
  3. The app crashes

Snack or a link to a repository

https://snack.expo.dev/OsONlb7lI

Screens version

3.18.0

React Native version

0.70.6

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

Expo managed workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

iPhone 14

Acknowledgements

Yes

@github-actions github-actions bot added Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided labels Jan 9, 2023
@wanschi
Copy link

wanschi commented Jan 11, 2023

We're facing the same error.

@asleepace
Copy link

Seeing the same thing using the authentication flow and a modal for sign-in

@nandorojo
Copy link

I've seen this as well.

@kkafar kkafar self-assigned this Jan 30, 2023
@kkafar kkafar linked a pull request Jan 31, 2023 that will close this issue
2 tasks
@Bogzzz
Copy link

Bogzzz commented Mar 23, 2023

So was the issue solved ? How can i fix it in my app ?

@kaheihong
Copy link

same issue here

@kaheihong
Copy link

kaheihong commented Apr 11, 2023

just found a workaround...in my case I am implementing google auth using a modal, so after I signin, I first close my modal via a toggle function in the 'then' statement and the app no longer crashes. i believe it is an compatibility issue between navigation and react-native modal. below is my code. hope it helps.

Screenshot 2023-04-11 at 6 50 33 PM

Screenshot 2023-04-11 at 6 50 26 PM

@Jeffreyoboe1
Copy link

Seeing same issue in our app.

@alex-trofimov
Copy link

Experiencing this one as well.

@adamivancza
Copy link

Here is a patch that should solve this issue based on @kkafar's PR above: #1704

diff --git a/node_modules/react-native-screens/ios/RNSScreen.mm b/node_modules/react-native-screens/ios/RNSScreen.mm
index 5dd618f..12dffc9 100644
--- a/node_modules/react-native-screens/ios/RNSScreen.mm
+++ b/node_modules/react-native-screens/ios/RNSScreen.mm
@@ -1067,10 +1067,18 @@ - (UIViewController *)findChildVCForConfigAndTrait:(RNSWindowTrait)trait includi
     // if we went into a modal here and ask it, it wouldn't take any effect. For fullScreen modals, the system
     // asks them by itself, so we can stop traversing here.
     // for screen orientation, we need to start the search again from that modal
-    return !includingModals
-        ? nil
-        : [(RNSScreen *)lastViewController findChildVCForConfigAndTrait:trait includingModals:includingModals]
-            ?: lastViewController;
+    // source: https://github.com/software-mansion/react-native-screens/pull/1704/files
+    if (!includingModals) {
+      return nil;
+    } else {
+      auto theVC = [(RNSScreen *)lastViewController findChildVCForConfigAndTrait:trait includingModals:includingModals];
+
+      if (theVC != nil) {
+        return theVC;
+      } else {
+        return lastViewController;
+      }
+    }
   }
 
   UIViewController *selfOrNil = [self hasTraitSet:trait] ? self : nil;

@kkafar
Copy link
Member

kkafar commented Sep 6, 2023

Hey, that was not ready. I had done some experimenting with this crash and it led me to conclusion that it arises from some weird react-native behaviour: react reuses/recycles native instances of certain components leading to invalid private state being present in native components (they are not properly deinitialized before being reused).
I haven't investigated it further yet.

@adamivancza
Copy link

@kkafar so you don't think we should use your code above? based on my testing this solves the crash and still displays modals correctly.

@kkafar
Copy link
Member

kkafar commented Sep 12, 2023

Hey, sorry for delay.

I do not think this code helps as those changes I've pushed out to GitHub are only cosmetic (I believe the logic/behaviour does not change at all) so that it was easier for me to set line breakpoints in debugger.

It the problem really disappeared it could be caused by some other change that was recently released.

@chanphiromsok
Copy link

I also had this issue with react-native 0.72.4 and react-native-modal 13.0.1 when modal is show and replace or reset navigation it crash only on IOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.