Skip to content
Permalink
Browse files

Use app name from app.json for registering application

Summary:
Currently when we change the app name in `app.json`, run `react-native eject` and then run the application, we get the following error `Application HelloWorld2 has not been registered`

<img src="https://user-images.githubusercontent.com/6805530/34646396-9a68ccd0-f38c-11e7-9a49-9f985dc20f14.png" width="33%" />

This PR picks up the app name from app.json while registering the application, which prevents the additional step for the user to change the app name while registering in the `index.js`

Tested using sinopia. The new app generated with the `react-native init HelloWorld` contains the changes made.

[CLI] [ENHANCEMENT] [index.js] - App name picked from from app.json for registering application.
Closes #17472

Differential Revision: D7788652

Pulled By: hramos

fbshipit-source-id: bf23318ae1994b06e5d5908f53818040db1ad5af
  • Loading branch information...
chiraggshah authored and facebook-github-bot committed Apr 27, 2018
1 parent 7b6dd2a commit 57774a4a981e2f12cfe9b029447e34f203221b18
Showing with 2 additions and 1 deletion.
  1. +2 −1 local-cli/templates/HelloWorld/index.js
@@ -1,4 +1,5 @@
import { AppRegistry } from 'react-native';
import App from './App';
import { name as appName } from './app.json';

AppRegistry.registerComponent('HelloWorld', () => App);
AppRegistry.registerComponent(appName, () => App);

0 comments on commit 57774a4

Please sign in to comment.
You can’t perform that action at this time.