Trying to start using your library instead of another one...
For brand new project created with react-native init MyCoolApp, and following your guide how to change index.js:
import {Navigation} from 'react-native-navigation';
import App from './App';
Navigation.registerComponent('navigation.AppScreen', () => App);
Navigation.events().registerAppLaunchedListener(() => {
Navigation.setRoot({
root: {
component: {
name: 'navigation.AppScreen',
},
},
});
});
I'm getting this error:
Invariant Violation: "MyCoolApp" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
runApplication
AppRegistry.js:188:4
<unknown>
debuggerWorker.js:187:58
process.<anonymous>
debuggerWorker.js:60:9
process.emit
events.js:198:13
emit
child_process.js:832:12
Sorry, looks like I missed some parts in the documentation, regarding editing AppDelegate.m file... Closing this issue.
I follow step by step documentation and I got same issue.
RNNv: 3.2.0
RN: 0.61.2
iOS
First, add RNN pod to Podfile.
Next, edit AppDelegate.m.
Error: Invariant Violation: "App" has no been registered.
I could fix it in Android, but not in iOS for 3 days
I had this issue, in my own case i was doing everything in AppDelegate.m file but there was a bridging code so i had to remove it.
Comment out this line of code
`RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"raajneti"
initialProperties:nil];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];`
Although I can't help,I don't think this is a solution. I also say more will bump on this thread and agree
@traxx10 solution is working. After reading the documentation I understood that the first function in the AppDelegate.m should replace it's previous code (the code that came with the empty project) by this one
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
return YES;
After many try, this was the solution for me...
Docs is confusing there is A or B, manual and autolink,but at the end for autolink you need to apply Manual steps, and however manual installation is not very descriptive at all.
Just remove all codes inside:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
And add the code specified in the documentation:
NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
return YES;
This solved the issue for me.
This can happens because you may forgot to delete #import
I have same error like this image. https://prnt.sc/roudp6
look at the file app.json and package.json and check same name field both files
So rename "Name" in app.json and package.json files.
NB: In app.json, the required naming convention is "myApp" and in package.json that would be "my-app".
Most helpful comment
I have same error like this image. https://prnt.sc/roudp6
look at the file app.json and package.json and check same name field both files
So rename "Name" in app.json and package.json files.