React-native-navigation: AppRegistry is required RN 0.61

Created on 30 Sep 2019  路  5Comments  路  Source: wix/react-native-navigation

Issue Description

React native 0.61 requires that i register a root component to AppRegistry.registerComponent() but my RNN root is a Navigation launched listener

Steps to Reproduce / Code Snippets / Screenshots

Screen Shot 2019-09-30 at 9 02 17 AM

Below is my code snippet for the index.js when i run it am getting an error
```javascript
// index.js
import {Navigation} from 'react-native-navigation';
import {registerScreens} from './src/screens';

registerScreens();
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: 'Initializing',
},
},
});
}); ```


Environment

  • React Native Navigation version: 2.27.9
  • React Native version: 0.61.1
  • Platform(s) (iOS, Android, or both?): both
  • Device info (Simulator/Device? OS version? Debug/Release?): simulator/ android 8.0

Most helpful comment

I get this error on Android, for me, it works fine on ios, anyone got a fix for android?

All 5 comments

You probably forgot to modify AppDelegate.m file, as I did recently... :) https://github.com/wix/react-native-navigation/issues/5520#issuecomment-535169968

@StasD thanks I fixed this by upgrading to V3.0.0-alpha11.

I get this error on Android, for me, it works fine on ios, anyone got a fix for android?

@StasD
Can you help me? I can't find any information at documentation about AppDelegate and how it should be modified?

@ifier I haven't been working on this for a few months, and it looks like wix's react-native-navigation changed significantly during this time: the current version is 6.7.3, while my app is still using 4.5.3...

Here are the current installation instructions for iOS: https://wix.github.io/react-native-navigation/docs/installing/#ios

My AppDelegate.h file looks like this:

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

and AppDelegate.m like this:

#import "AppDelegate.h"
#import <React/RCTBundleURLProvider.h>
#import "ReactNativeNavigation.h"
#import "RNSplashScreen.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  #ifdef DEBUG
    jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  #else
    jsCodeLocation = [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
  #endif

  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  [RNSplashScreen show];

  return YES;
}

@end

(You will probably need to remove lines related to RNSplashScreen if you are not using this library).

Hope this helps a little bit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

yedidyak picture yedidyak  路  3Comments

henrikra picture henrikra  路  3Comments

birkir picture birkir  路  3Comments

kiroukou picture kiroukou  路  3Comments