Answers for "Invariant Violation: has not been registered. react native"

0

Invariant Violation: has not been registered. react native

Some Solutions that worked for me:
I got this issue after renaming the project name and a couple of 
files. to solve it just make sure that the name of the app is the same in 
index.js app.json, MainActivity.java and AppDelegate.m.

Solution 1 Inside app.json File:
{ "name": "MyNewApp", "displayName": "MyNewApp" }

Solution 2 :
// AppRegistry defines the entry point to the application and provides the 
// root component. Your first param doesn't match your project name.
// First param of registerComponent has to be your project name, second param 
// is anonymous function that returns your root react component.
// If first param doesn't match xcode project name, you get that error that
// your application has not been registered.
Inside index.js File:
AppRegistry.registerComponent('MyNewApp', () => MyNewApp);

Solution 3:
Inside MainActivity.java File:
@Override protected String getMainComponentName() {
	return "MyNewApp"; 
}

Solution 4:
// Be sure that the 'AppName' you pass into the
// AppRegistry.registerComponent('AppName' /* <- */, ... )
// matches with the @"AppName" on your AppDelegate.m on the call for
Inside AppDelegate.m File:
[[RCTRootView alloc] initWithBundleUrl:...
                            moduleName:@"AppName" // <-
                         launchOptions:...
Posted by: Guest on June-26-2021

Code answers related to "Invariant Violation: has not been registered. react native"

Code answers related to "Javascript"

Browse Popular Code Answers by Language