React-native-navigation: Navigation.setRoot crash on iOS with rnn v2.17.0

Created on 9 Apr 2019  路  15Comments  路  Source: wix/react-native-navigation

Issue Description

I updated RNN from 2.16.0 to 2.17.0 today.
After the update I get an error when calling Navigation.setRoot when starting the app.
I tested reverting to 2.16.0 and then it starts working again.

Navigation.setRoot({
        root: {
          stack: {
            children: [
              {
                component: {
                  name: 'homeScreen',
                },
              },
            ],
          },
        },
 });

I get this error in xcode:

Exception '-[RNNRootViewController initWithLayoutInfo:creator:options:defaultOptions:presenter:eventEmitter:]: unrecognized selector sent to instance 0x106546f60' was thrown while invoking setRoot on target RNNBridgeModule with params (
    setRoot3,
        {
        modals =         (
        );
        overlays =         (
        );
        root =         {
            children =             (
                                {
                    children =                     (
                    );
                    data =                     {
                        name = homeScreen;
                        options =                         {
                        };
                    };
                    id = Component2;
                    type = Component;
                }
            );
            data =             {
            };
            id = Stack1;
            type = Stack;
        };
    },
    56,
    57
)

Environment

  • React Native Navigation version: 2.17.0
  • React Native version: 0.59.4
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Device, iOS 12.2
iOS

Most helpful comment

This issue seems to be related to the build cache itself and not to react-native-navigation.
I managed to reproduce the issue, bootstrapped a new RN project with [email protected] and ran react-native run-ios, then upgraded to [email protected] and ran again react-native run-ios.

The solution is to remove ios/build folder and run react-native run-ios.

All 15 comments

same here

Environment

  • React Native Navigation version: 2.17.0
  • React Native version: 0.59.2
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator iPhoneX iOS12.1

Screen Shot 2019-04-09 at 22 02 18

my route looks like below

function registerComponents() {
  Navigation.registerComponent('Detail', () => Detail)
  Navigation.registerComponent('Preview', () => Preview)
  Navigation.registerComponent('Filter', () => Filter)
  Navigation.registerComponent(
    'Search',
    () => props => (
      <SearchContextProvider>
        <Search {...props} />
      </SearchContextProvider>
    ),
    () => Search
  )
}

registerComponents()

Navigation.events().registerAppLaunchedListener(() => {
  Navigation.setRoot({
    root: {
      stack: {
        children: [
          {
            component: {
              name: 'Search',
              options: {
                topBar: {
                  visible: false
                }
              }
            }
          }
        ]
      }
    }
  })
})

it seems related to this change?
Screen Shot 2019-04-09 at 22 22 07

Sorry my bad, mine was fixed by putting the following code back in AppDelegate.h, which I need in order to remove Class 'AppDelegate' does not conform to protocol 'RCTBridgeDelegate' warning according to the doc.

You can remove RCTBridgeDelegate from this file: AppDelegate.h:`

- #import <React/RCTBridgeDelegate.h>
- @interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
+ @interface AppDelegate : UIResponder <UIApplicationDelegate>

Any update on this?

hey @aminosman, we're out of the office for the next couple of days and will get to this on Wednesday. Sorry for the inconvenience.

Thanks @guyca

same here

Same. I only see this error when i run react-native run-ios. If i run the app from xcode in debug mode I don't see the error and can continue programming as usual. This has been my current workaround until it's fixed.

This issue seems to be related to the build cache itself and not to react-native-navigation.
I managed to reproduce the issue, bootstrapped a new RN project with [email protected] and ran react-native run-ios, then upgraded to [email protected] and ran again react-native run-ios.

The solution is to remove ios/build folder and run react-native run-ios.

Thanks for looking into this.
I will give it a try as soon as I have time.

I cleared the build cache and am still seeing this issue

Can you try removing both ios/DerivedData and ios/build?
Also delete the app from your device

Deleting the ios/build folder solved the issue for me. I did not have an ios/DerivedData folder. Thanks @yogevbd

Ok looks like DerivedData was the trick, that got it working for me.

Awesome! closing the issue

thanks @shuzootani !

Was this page helpful?
0 / 5 - 0 ratings