Application Icon is the Unique identification of the App. When the user wants to open an app, the icon is the first thing which helps him/her to identify the app. In this post, we will see how to Change App Icon in React Native using the Command Line Interface.
This example is perfectly tested for MAC or Ubuntu if you are a Windows user then you can follow our Example of React Native Change App Icon which is fully working and tested on all development platform. We tried to change the App Icon using the command line on Windows too but we are unable to do that so until we find the perfect solution for that you can use React Native Change App Icon example to change the App Icon in windows.
Our previous example React Native Change App Icon explains how to manually set up your React Native app icons:
- First, you have to generate icons of different sizes
- Then, you have to add them to your Android and iOS projects
In an Ionic process, we could automate this process with a single command line, why not have the same for React Native? So we started to find any way to do so and now we are here with RN ToolBox.
RN ToolBox will help you to set up your App Icon using Command Line Interface but for that, you need
node > 6 installed. you can check it using
After checking the node install jump into your project and install the generator using:
npm install -g yo generator-rn-toolbox
To generate your icons, the generator uses ImageMagick. On macOS, you can install it with:
brew install imagemagick
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>
# in my case my icon name app_logo.png
yo rn-toolbox:assets --icon ../app_logo.png
You will be asked for the name of your react-native project. So copy the name of your project and paste it there.
When you are asked:
? Overwrite ios/IconExample/Images.xcassets/AppIcon.appiconset/Contents.json?, reply with
Congratulation!! you have successfully updated your App Icon from the command line.
This is how you can change the App Icon using Command Line Interface. If you have anything else to share please comment below or contact us here.
Hope you liked it:)
How useful was this post?
Click on a star to rate us!
Average rating / 5. Vote count:
We are sorry that this post was not useful for you!
Let us improve this post!
Thanks for your feedback!