React-native-navigation: Navigation.showModal with RN Modal showing

Created on 16 Jul 2018  ·  2Comments  ·  Source: wix/react-native-navigation

If a React Native Modal is showing on the screen, trying to use Navigation.showModal() will crash natively with native crashlog

Exception '-[RCTModalHostViewController getLeafViewController]: unrecognized selector sent to instance 0x--------' was thrown while invoking showModal on target RNNBridgeModule with params ...

Environment:

  • React Native Navigation version: 2.0.2412
  • React Native version: 51
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator iPhone X
iOS acceptebug v2

Most helpful comment

I'm having very similar issue.

It happens only if I'm using stack layout.

If I'm trying to open modal, app crash with. If I'm not using stack layout, it will work properly.

Exception '-[RNNTabBarController options]: unrecognized selector sent to instance 0x7fcb4c00ca00' was thrown while invoking showModal on target RNNBridgeModule with params (
  showModal13,
      {
      children =         (
      );
      data =         {
          name = "Screen.QrKZrTZ7wK";
          options =             {
          };
      };
      id = Component12;
      type = Component;
  },
  2246,
  2247
)
callstack: (
0   CoreFoundation                      0x0000000106d971e6 __exceptionPreprocess + 294
1   libobjc.A.dylib                     0x000000010520c031 objc_exception_throw + 48
2   CoreFoundation                      0x0000000106e18784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   UIKit                               0x000000010ab506db -[UIResponder doesNotRecognizeSelector:] + 295
4   CoreFoundation                      0x0000000106d19898 ___forwarding___ + 1432
5   CoreFoundation                      0x0000000106d19278 _CF_forwarding_prep_0 + 120
6   MY_APPL                             0x0000000104192f9a -[RNNModalManager showModalAfterLoad:] + 202
7   MY_APPL                             0x000000010419381a __40-[RNNModalManager showModal:completion:]_block_invoke + 42
8   MY_APPL                             0x00000001041671c1 -[RNNRootViewController waitForReactViewRender:perform:] + 97
9   MY_APPL                             0x0000000104193765 -[RNNModalManager showModal:completion:] + 1061
10  MY_APPL                             0x00000001041c5ded -[RNNCommandsHandler showModal:completion:] + 333
11  MY_APPL                             0x000000010419203e -[RNNBridgeModule showModal:layout:resolver:rejecter:] + 270
12  CoreFoundation                      0x0000000106d1accc __invoking___ + 140
13  CoreFoundation                      0x0000000106d1ab84 -[NSInvocation invoke] + 308
14  CoreFoundation                      0x0000000106d338d6 -[NSInvocation invokeWithTarget:] + 54
15  MY_APPL                             0x000000010427befc -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796
16  MY_APPL                             0x0000000104331f42 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786
17  MY_APPL                             0x0000000104331a6f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
18  MY_APPL                             0x00000001043319e9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
19  libdispatch.dylib                   0x0000000109b0d6cb _dispatch_call_block_and_release + 12
20  libdispatch.dylib                   0x0000000109b0e709 _dispatch_client_callout + 8
21  libdispatch.dylib                   0x0000000109b18708 _dispatch_main_queue_callback_4CF + 1279
22  CoreFoundation                      0x0000000106d59c99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
23  CoreFoundation                      0x0000000106d1dea6 __CFRunLoopRun + 2342
24  CoreFoundation                      0x0000000106d1d30b CFRunLoopRunSpecific + 635
25  GraphicsServices                    0x000000010dfdba73 GSEventRunModal + 62
26  UIKit                               0x000000010a922057 UIApplicationMain + 159
27  MY_APPL                             0x0000000104151d1f main + 111
28  libdyld.dylib                       0x0000000109b83955 start + 1
29  ???                                 0x0000000000000001 0x0 + 1
)

All 2 comments

I'm having very similar issue.

It happens only if I'm using stack layout.

If I'm trying to open modal, app crash with. If I'm not using stack layout, it will work properly.

Exception '-[RNNTabBarController options]: unrecognized selector sent to instance 0x7fcb4c00ca00' was thrown while invoking showModal on target RNNBridgeModule with params (
  showModal13,
      {
      children =         (
      );
      data =         {
          name = "Screen.QrKZrTZ7wK";
          options =             {
          };
      };
      id = Component12;
      type = Component;
  },
  2246,
  2247
)
callstack: (
0   CoreFoundation                      0x0000000106d971e6 __exceptionPreprocess + 294
1   libobjc.A.dylib                     0x000000010520c031 objc_exception_throw + 48
2   CoreFoundation                      0x0000000106e18784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   UIKit                               0x000000010ab506db -[UIResponder doesNotRecognizeSelector:] + 295
4   CoreFoundation                      0x0000000106d19898 ___forwarding___ + 1432
5   CoreFoundation                      0x0000000106d19278 _CF_forwarding_prep_0 + 120
6   MY_APPL                             0x0000000104192f9a -[RNNModalManager showModalAfterLoad:] + 202
7   MY_APPL                             0x000000010419381a __40-[RNNModalManager showModal:completion:]_block_invoke + 42
8   MY_APPL                             0x00000001041671c1 -[RNNRootViewController waitForReactViewRender:perform:] + 97
9   MY_APPL                             0x0000000104193765 -[RNNModalManager showModal:completion:] + 1061
10  MY_APPL                             0x00000001041c5ded -[RNNCommandsHandler showModal:completion:] + 333
11  MY_APPL                             0x000000010419203e -[RNNBridgeModule showModal:layout:resolver:rejecter:] + 270
12  CoreFoundation                      0x0000000106d1accc __invoking___ + 140
13  CoreFoundation                      0x0000000106d1ab84 -[NSInvocation invoke] + 308
14  CoreFoundation                      0x0000000106d338d6 -[NSInvocation invokeWithTarget:] + 54
15  MY_APPL                             0x000000010427befc -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796
16  MY_APPL                             0x0000000104331f42 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786
17  MY_APPL                             0x0000000104331a6f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
18  MY_APPL                             0x00000001043319e9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
19  libdispatch.dylib                   0x0000000109b0d6cb _dispatch_call_block_and_release + 12
20  libdispatch.dylib                   0x0000000109b0e709 _dispatch_client_callout + 8
21  libdispatch.dylib                   0x0000000109b18708 _dispatch_main_queue_callback_4CF + 1279
22  CoreFoundation                      0x0000000106d59c99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
23  CoreFoundation                      0x0000000106d1dea6 __CFRunLoopRun + 2342
24  CoreFoundation                      0x0000000106d1d30b CFRunLoopRunSpecific + 635
25  GraphicsServices                    0x000000010dfdba73 GSEventRunModal + 62
26  UIKit                               0x000000010a922057 UIApplicationMain + 159
27  MY_APPL                             0x0000000104151d1f main + 111
28  libdyld.dylib                       0x0000000109b83955 start + 1
29  ???                                 0x0000000000000001 0x0 + 1
)

Im having same issue

Environment:

React Native Navigation version: "^2.0.2556",
React Native version: 55
Platform(s) (iOS, Android, or both?): iOS
Device info (Simulator/Device? OS version? Debug/Release?): Simulator iPhone

Navigation.showModal({
  stack: {
    children: [{
      component: {
        name: 'example.ModalScreen',
        passProps: {
          text: 'stack with one child'
        },
        options: {
          topBar: {
            title: {
              text: 'Modal'
            }
          }
        }
      }
    }]
  }
});

crash log:

2018-09-23 15:37:50.439751+0700 myApp[20606:516230] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010640929b __exceptionPreprocess + 331
    1   libobjc.A.dylib                     0x0000000104c06735 objc_exception_throw + 48
    2   CoreFoundation                      0x00000001063538fc _CFThrowFormattedException + 194
    3   CoreFoundation                      0x000000010632f3b2 -[__NSArrayM objectAtIndex:] + 178
    4   myApp                 0x0000000101e9d442 -[RNNRootViewController setCustomNavigationComponentBackground] + 1298
    5   myApp                 0x0000000101e9b844 -[RNNRootViewController optionsUpdated] + 100
    6   myApp                 0x0000000101ec491f -[RNNNavigationOptions applyOn:] + 671
    7   myApp                 0x0000000101e9b12b -[RNNRootViewController viewWillAppear:] + 139
    8   UIKitCore                           0x00000001158366e3 -[UIViewController _setViewAppearState:isAnimating:] + 690
    9   UIKitCore                           0x0000000115836e74 -[UIViewController __viewWillAppear:] + 131
    10  UIKitCore                           0x00000001153e1d42 -[UINavigationController viewWillAppear:] + 435
    11  UIKitCore                           0x00000001158366e3 -[UIViewController _setViewAppearState:isAnimating:] + 690
    12  UIKitCore                           0x0000000115836e74 -[UIViewController __viewWillAppear:] + 131
    13  UIKitCore                           0x0000000115465818 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 1155
    14  UIKitCore                           0x000000011510d97e _runAfterCACommitDeferredBlocks + 318
    15  UIKitCore                           0x00000001150fc424 _cleanUpAfterCAFlushAndRunDeferredBlocks + 384
    16  UIKitCore                           0x000000011512b870 _afterCACommitHandler + 135
    17  CoreFoundation                      0x000000010636c037 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
    18  CoreFoundation                      0x00000001063664ce __CFRunLoopDoObservers + 430
    19  CoreFoundation                      0x0000000106366b61 __CFRunLoopRun + 1537
    20  CoreFoundation                      0x0000000106366221 CFRunLoopRunSpecific + 625
    21  GraphicsServices                    0x000000010c3fc1dd GSEventRunModal + 62
    22  UIKitCore                           0x0000000115102115 UIApplicationMain + 140
    23  myApp                 0x0000000101d90f00 main + 112
    24  libdyld.dylib                       0x000000010953d551 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

viper4595 picture viper4595  ·  3Comments

ghost picture ghost  ·  3Comments

kiroukou picture kiroukou  ·  3Comments

charlesluo2014 picture charlesluo2014  ·  3Comments

EliSadaka picture EliSadaka  ·  3Comments