Skip to content

Instantly share code, notes, and snippets.

@febeling
Forked from dayhaysoos/eject.md
Created April 18, 2018 08:02
Show Gist options
  • Save febeling/0e8344ce0d22215a8c9137674e8f78d4 to your computer and use it in GitHub Desktop.
Save febeling/0e8344ce0d22215a8c9137674e8f78d4 to your computer and use it in GitHub Desktop.
eject command for React Native

Reconfigure

If your project has any issues with the native folders, you can rebuild them by deleting both the ios and android directories at the root level of your project and running this command:

$ react-native eject

Running this command will check if the ios and android directories exist and then rebuild whichever one is missing.

The first time you run this command it will spit out a configuration JSON file called app.json. By default, app.json will have 2 properties:

{
  "name": "AwesomeProject",
  "displayName": "AwesomeProject"
}

You can change the project name here but updating the name and displayName values and running react-native eject again.

The second time you run this command it will refer to app.json and rebuild with the new name as the only change.

Updating project icon with eject command

You can also change your projects app icon using the app.json config. Simply add an icon property:

{
  "name": "AwesomeProject",
  "displayName": "AwesomeProject",
  "icon": {
    "ios": "AwesomeProject-logo-iOS.png",
    "android": "AwesomeProject-logo-android.png",
    "default": "AwesomeProject-logo.png"
  }
} 

You can use the default property to set the app icon for both platforms, or if you need them to be different for each platform you can override default with either the ios or android properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment