I am currently going through the React-Native tutorials. I began with the Getting Started tutorial, where I made a new react native project and successfully managed to run t
you need to register it in index.android.js / index.ios.js
like this:
'use strict';
import {
AppRegistry
} from 'react-native';
import app from "./app";
AppRegistry.registerComponent('test', () => app);
This can also be due to Root component name starts with lowercase.
Recorrect it or rather create the project once again with a PascalCase name.
e.g. ignite new HelloWord
First of all you must start your application:
react-native start
Then, you must set your application name as the first argument of registerComponent.
It works fine.
AppRegistry.registerComponent('YourProjectName', () => YourComponentName);
Rather than changing the name in AppRegistry
,
Run react-native init Bananas , this will create react boilerplate code for Bananas project and AppRegistry.registerComponent
will automatically point to bananas
AppRegistry.registerComponent('Bananas', () => Bananas);
I had the same problem. I was using Windows for creating a react native app for android and was having the same error. Here's what worked.
sdk.dir = C:\Users\ USERNAME \AppData\Local\Android\sdk
Save and run the app normally. That worked for me.
The issue will also appear when, in index.js, you have named the app differently from the name you gave it for the android/ios package; probably this happened when you've ejected the app. So be sure that when calling AppRegistry.registerComponent('someappname', () => App)
, someappname is also used for the native packages or viceversa.