Skip to content

Instantly share code, notes, and snippets.

@dayhaysoos
Created March 10, 2017 13:22
Show Gist options
  • Save dayhaysoos/0eb673452c34e085b3f04fd5c1cbcc9f to your computer and use it in GitHub Desktop.
Save dayhaysoos/0eb673452c34e085b3f04fd5c1cbcc9f 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.

@canhnht
Copy link

canhnht commented Jun 27, 2017

+1

@renatobenks-zz
Copy link

👍

@montao
Copy link

montao commented Mar 16, 2018

Not working.

@billtlee
Copy link

Hi, for the icon, where should I place them? Thx!

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