I just installed React Native, and am attempting to follow tutorials on the React Native website to get accustomed to it. However every tutorial I end up doing just gives me a big red error screen in the iOS Simulator.
As an example, I followed the "Hello World" tutorial on the React Native website
import React, { Component } from 'react';
import { AppRegistry, Text } from 'react-native';
class HelloWorldApp extends Component {
render() {
return (
<Text>Hello world!</Text>
);
}
}
AppRegistry.registerComponent('HelloWorldApp', () => HelloWorldApp);
but am met with this error after compiling and running in the simulator"
"Application TestProject has not been registered. This is either due to a require() error during initialization or failure to call AppRegistry.registerComponent"
I'm confused because I know nothing yet about RN, am following their tutorials to the letter, and am getting errors.
Please advise?
There might be two possibilities as I know of:
react-native run-ios
thepackager
didn't start automatically. If that's the case, Run the Packager Manually. To do so:In one Tab of your terminal run
react-native start
and in another runreact-native run-ios
.You created a project using
react-native init AwesomeProject
. The Project's name here isAwesomeProject
.And then changed your default
index.ios.js
and replaced the Component's name withHelloWorldApp
.