Rename React Native App
In this section, we will see how to rename the React Native app with just one command. In this section, rename does not mean the change in the root directory name, I am talking about the change of all the properties and the package name. There are many cases where we start solving the big problem of our app and finally want to make the demo application as a base of our application, in that case, we have 2 cases either we can continue with the same package but need to update the name of the app or we have to create a new application with original name and have to do the same thing again and If you ask me what to do then I will prefer to change the name of the package as I don't want to set up all those things again.
It is not the single case where you have to change the name of your app many times we have to rename the app on the request of the application owner so here we will see how easily you can rename the React Native App.
So to rename the application we have a tool called
react-native-rename. It is very easy to install and use tool.
To rename the react native app
First of all, you need to install the
react-native-rename tool. It is a CLI tool and you need to install the tool in the same manner as you do while installing
1. Open your terminal and install the tool by running the following command. you have to do it for once as it will install globally and you can use it anytime in any project now.
npm install react-native-rename -g
2. To rename any project, jump into the project using
3. Now run the below command
you have to replace your new app name with the <NewName>.
Ex. react-native-rename NewAppName
4. To change the bundle identifier for iOS you have to open the Xcode and have to change from there but for the android package you can add an extra parameter to rename the package too
you have to replace your new app name with the <NewName> and package name with <bundleIdentifier>.
Ex. react-native-rename NewAppName -b com.aboutreact.newappname
react-native-rename <NewName> -b <bundleIdentifier>
you can get more info from here and can see the process below as well. The library owner has suggested making a different branch for the updated code or to take the backup in case of any issue.