Hello everyone, Welcome to this new article, where we are going to explore how to rename your react native app after you start with a boilerplate or a testing project.
A lot of us have faces this small but really important issue of starting a project through a github repository or from scratch just playing around, then deciding to publish that project.
Besides React Native, this is a real problem itself if you are working with Xcode or android studio, because you will have to manage the paths and hell of other things.
Let’s Get Started
To rename a react native app, we are going to use an React native-rename package Which will handle all the process for us with a single command.
Install React Native Rename globally
yarn global add react-native-rename or using NPM npm install react-native-rename -g
Then you can simply use the command
And if you want to change the Bundle Identifier
react-native-rename <<newName>> -b <<bundleIdentifier>>
Notice: This will only work for Android, to change the Bundle Identifier on an IOS project, you will have to use Xcode.
react-native-rename "Weather App"
And with the Bundle identifier
react-native-rename "Weather App" -b "com.reactnativemaster.weatherapp"
Notice: This package will not attempt to properly rename build artifacts such as
ios/build or Cocoa Pod installation targets. After re-naming your project you probably should clean, then build, and reinstall your dependencies to get it running properly with the your new name.
Another Method For Expo Projects
The Library React Native Rename works mostly on React Native CLI projects and have problems with expo projects.
To rename you expo react native app, you can follow the instructions below
- Copy your icons from iOS and Android
app.jsonto the new name
- Replace the icons you copied earlier
There you have it, now you can rename your react native project simply in few lines of code.
I hope you find it as informative as you have expected.
Feel free to share it with your friends, and comment out your questions and concerns.
Stay safe, and Happy coding