mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
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 https://github.com/facebook/react-native/pull/17472 Differential Revision: D7788652 Pulled By: hramos fbshipit-source-id: bf23318ae1994b06e5d5908f53818040db1ad5af
This commit is contained in:
committed by
Facebook Github Bot
parent
7b6dd2a661
commit
57774a4a98
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user