wix / react-native-navigation

A complete native navigation solution for React Native
https://wix.github.io/react-native-navigation/
MIT License
13.04k stars 2.67k forks source link

[V2] showModal not working on 0.56.rc4 #3468

Closed jp928 closed 5 years ago

jp928 commented 6 years ago

Issue Description

Navigation.showModal quit the app immediately

Steps to Reproduce / Code Snippets / Screenshots


Navigation.showModal({
  stack: {
    children: [{
      component: {
         name: 'test.Screen'
      }
    }]
  }
});

Environment

guyca commented 6 years ago

Can you please include a stack trace?

LeVadim commented 6 years ago

Same issue on my end, due to this error cannot upgrade to newer versions. XCode error demonstrates native code cannot access animation params.

Thank you!

LeVadim commented 6 years ago

Seems the issue had been fixed with BottomTabs, however, it is still not working with Sidemenu. Error - "RNNSideMenuController options]: unrecognized selector sent to instance 0x104...' was thrown while invoking showModal on target RNNBridgeModule with params ( ... Please look into it. Thank you!

jp928 commented 6 years ago

@LeVadim I tried 0.56.0 today, it works fine now.

LeVadim commented 6 years ago

@jp928 Even with SideMenu? (as I got a crash when I was using Sidemenu) Would you be able to share your code you`re using to setRoot with sidemenu?

Thank you!

jp928 commented 6 years ago

@LeVadim After I upgrade react-native-navigation": "^2.0.2397",

I have similar issue: screen shot 2018-07-06 at 9 47 13 am

Try downgrade to 2.0.2381.

LeVadim commented 6 years ago

@jp928 I had an exact same issue, thank you for posting a screenshot!

luskin commented 6 years ago

Seeing same issue here on iOS (fine on android) on v2.0.2399:

img_cc51ecbaaf3b-1

luskin commented 6 years ago

@guyca Here is our stack trace. Happens every time we try and call showModal on RN 0.56.0 and RNN 2.0.2415

2018-07-16 14:34:43.129914-0700 Driver[75622:3215909] -[RCTModalHostViewController getLeafViewController]: unrecognized selector sent to instance 0x7f9ed8b39b90
2018-07-16 14:34:43.134 [fatal][tid:main] Exception '-[RCTModalHostViewController getLeafViewController]: unrecognized selector sent to instance 0x7f9ed8b39b90' was thrown while invoking showModal on target RNNBridgeModule with params (
    showModal18,
        {
        children =         (
                        {
                children =                 (
                );
                data =                 {
                    name = "Driver.SignatureCapture";
                    options =                     {
                        topBar =                         {
                            animate = 0;
                            drawBehind = 1;
                            visible = 0;
                        };
                    };
                    passProps =                     {
                        *********: **************";
                    };
                };
                id = Component17;
                type = Component;
            }
        );
        data =         {
        };
        id = Stack16;
        type = Stack;
    },
    4244,
    4245
)
callstack: (
    0   CoreFoundation                      0x000000011860b1e6 __exceptionPreprocess + 294
    1   libobjc.A.dylib                     0x000000011785f031 objc_exception_throw + 48
    2   CoreFoundation                      0x000000011868c784 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKit                               0x0000000114fef6db -[UIResponder doesNotRecognizeSelector:] + 295
    4   CoreFoundation                      0x000000011858d898 ___forwarding___ + 1432
    5   CoreFoundation                      0x000000011858d278 _CF_forwarding_prep_0 + 120
    6   Driver                              0x000000010e9b7294 -[RNNModalManager showModalAfterLoad:] + 116
    7   Driver                              0x000000010e9b7b2a __40-[RNNModalManager showModal:completion:]_block_invoke + 42
    8   Driver                              0x000000010e98b741 -[RNNRootViewController waitForReactViewRender:perform:] + 97
    9   Driver                              0x000000010e9b7a75 -[RNNModalManager showModal:completion:] + 1061
    10  Driver                              0x000000010e9e9e9d -[RNNCommandsHandler showModal:completion:] + 333
    11  Driver                              0x000000010e9b638e -[RNNBridgeModule showModal:layout:resolver:rejecter:] + 270
    12  CoreFoundation                      0x000000011858eccc __invoking___ + 140
    13  CoreFoundation                      0x000000011858eb84 -[NSInvocation invoke] + 308
    14  CoreFoundation                      0x00000001185a78d6 -[NSInvocation invokeWithTarget:] + 54
    15  Driver                              0x000000010e31c30c -[RCTModuleMethod invokeWithBridge:module:arguments:] + 2796
    16  Driver                              0x000000010e3d2352 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 786
    17  Driver                              0x000000010e3d1e7f _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 127
    18  Driver                              0x000000010e3d1df9 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
    19  libdispatch.dylib                   0x0000000119b857ab _dispatch_call_block_and_release + 12
    20  libdispatch.dylib                   0x0000000119b867ec _dispatch_client_callout + 8
    21  libdispatch.dylib                   0x0000000119b918cf _dispatch_main_queue_callback_4CF + 628
    22  CoreFoundation                      0x00000001185cdc99 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    23  CoreFoundation                      0x0000000118591ea6 __CFRunLoopRun + 2342
    24  CoreFoundation                      0x000000011859130b CFRunLoopRunSpecific + 635
    25  GraphicsServices                    0x000000011b4f4a73 GSEventRunModal + 62
    26  UIKit                               0x0000000114dc1057 UIApplicationMain + 159
    27  Driver                              0x000000010dff801f main + 111
    28  libdyld.dylib                       0x0000000119c03955 start + 1
)
pie6k commented 6 years ago

I've got the same issue.

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
)

It happens only if I use stack layout. If root of my app is tabs layout it works, but then I'm not able to push screens at top level.

luskin commented 6 years ago

A tad more info on this, it looks like we are able to present a modal once, but presenting any modals following that modal causes the error for us.

luskin commented 6 years ago

So we updated to RNN 2.0.2425 and now we do not receive the error when showing the modal, HOWEVER, the screen is immediately closed after calling the componentDidAppear (confirmed with a console log) but it is not fully closed as the rest of the app is rendered unusable (like it's a transparent overlay or something over the rest of the app)

pie6k commented 6 years ago

Thanks @luskin . Actually, crash I've posted yesterday happens on 2.0.2425. Not sure if it's helpful for you. Let me know if you'd need any more details to be able to reproduce it.

luskin commented 6 years ago

@pie6k This is quite inconsistent because according to you if your root is a tab based app then you don't receive the error but my app is a tab based app and USED to receive the error before upgradeing to 2.0.2425 but not, like I mentioned, no actual error but the app breaks. Are you using stacks in the tab bar root? Would you mind posting your tab bar code? here is ours:


export const launchMainApp = () => {

  Navigation.setRoot({
    root: {
      bottomTabs: {
        children: [
          MainAppTab(Screens.Dispatches, 'Dispatches', Icons.TabBar.Dispatches),
          MainAppTab(Screens.History, 'History', Icons.TabBar.History),
          MainAppTab(Screens.Account, 'Account', Icons.TabBar.Account)
        ],
        options: {

        }
      }
    }
  })
}

const MainAppTab = (screen, title, icon) => ({
  stack: {
    id: screen,
    children: [
      {
        component: {
          name: screen
        }
      }
    ],
    options: {
      bottomTabs: {
        visible: true,
        animate: false,
        drawBehind: false,
        backgroundColor: Colors.Black
      },
      bottomTab: {
        text: title,
        icon: icon,
        selectedIcon: icon,
        textColor: Colors.White,
        selectedTextColor: Colors.Yellow,
        selectedIconColor: Colors.Yellow,
        iconColor: Colors.White,
        fontSize: 10
      }
    }
  }
})
luskin commented 6 years ago

@pie6k any update on your end? Just updated to most recent version and the problem still exists.

rgoldiez commented 6 years ago

Any word on a fix for this? It seems to be an issue with bottomTabs embedded in a stack view and trying to perform a showModal from within a bottomTabs component.

dorthwein commented 6 years ago

Getting this as well - also bottomTabs based

terreb commented 6 years ago

Does anyone have a temporal workaround for this until it's fixed on RNN v2 side?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] commented 5 years ago

The issue has been closed for inactivity.

DavitVosk commented 5 years ago

I have the same problem here. My RN version is 59.2 and RNN version is 2.26.5. Please help

DavitVosk commented 5 years ago

I see that on Dec3, 2018 this bug had been moved to Done, but the problem is not solved yet.

DavitVosk commented 5 years ago

Ok I found what is wrong in my code. In AppDelegate.m this self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; row was not allowing my modal to be appeared on the screen when I was calling showModal... After removing that line of code everything started to work as needed. Hope this can help anyone else too

ghost commented 5 years ago

@DavitVosk Thank you it worked for me!!