Skip to content

Instantly share code, notes, and snippets.

@jlcarvalho
Created August 17, 2017 20:03
Show Gist options
  • Save jlcarvalho/bb8418ad10c9408e7f2a66105b229ef1 to your computer and use it in GitHub Desktop.
Save jlcarvalho/bb8418ad10c9408e7f2a66105b229ef1 to your computer and use it in GitHub Desktop.
React Native Icon Automation

https://blog.bam.tech/developper-news/how-to-generate-your-react-native-app-icons-in-a-single-command-line

It generates your assets and it also adds them correctly to your ios and android project.

Install it

You need node 6 installed and image-magick.

Then install the generator with

npm install -g yo generator-rn-toolbox

Use it

Have a single icon file at the ready somewhere. 200x200px is sufficient.

Then in your React Native project, run:

yo rn-toolbox:assets --icon <path to your icon>
# For instance
yo rn-toolbox:assets --icon ../icon.png
enter code here

You will be asked for the name of your react-native project. For instance, if you created your project with react-native init MyAwesomeProject, your project name is MyAwesomeProject.

When you are asked, ? Overwrite ios/MyAwesomeProject/Images.xcassets/AppIcon.appiconset/Contents.json?, reply with Y.

And... that's it!

Source

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