Reputation: 2164
It's simple issue but I don't know how to do it. I'm looking for some references, but there are problems.
react-native : 0.60.5
. Hence there is no eject
method or command.expo
.After I referenced How to Rename A React Native App and error Unrecognized command "eject", then I follow the process below.
app.json
's name
and diplayName
field to name which I want to changeandroid/
and ios/
directoryreact-native upgrade --legacy true
But there is no change on the project name and app name.
Is there any way to change the project and app name? Thanks.
Upvotes: 4
Views: 16531
Reputation: 1018
If you're using the Expo Bare Workflow, and you want to change the app display name without changing the project or package name, you'll need to modify the native Android and iOS configurations directly in their respective native files.
TLDR
iOS: Modify CFBundleDisplayName
in Info.plist
Android: Modify android:label
in AndroidManifest.xml
iOS:
In the Expo Bare Workflow, you can directly modify the iOS project settings in the Info.plist
file.
ios/<your-project-name>/Info.plist
CFBundleDisplayName
in the Info.plist
file. If it's not there, add it:<key>CFBundleDisplayName</key>
<string>Your New App Name</string>
This change will update the app's display name as it appears on users' iOS devices.
Android:
For Android, you need to modify the android:label
attribute in the AndroidManifest.xml
file.
android/app/src/main/AndroidManifest.xml
android:label
attribute inside the <application>
tag:<application
android:name=".MainApplication"
android:label="Your New App Name"
android:icon="@mipmap/ic_launcher">
<!-- other configurations -->
</application>
This will change the name that appears under the app icon on Android devices.
These changes will not affect your project or package names and will only modify the display name that users see under the app icon. After making these changes, just rebuild your project.
Upvotes: 1
Reputation: 497
I had a very hard time with this and this is what I did - hopefully it helps someone. Literally took me 15 minutes
To make it work for ios
To make it work for android
I know its a lot of steps, but from what I have found renaming react native app is not actually as easy as you might have thought
Upvotes: 1
Reputation: 254
for android edit strings.xml file which located in res/values/
string name="app_name">APP_NAME</string
Upvotes: 2
Reputation: 12195
Please check the below steps :
if you want to change both the app name and the package name (i.e. rename the entire app), the following steps are necessary:
Make sure you don't have anything precious (non-generated, manually copied resources) in the android/ and ios/ subfolders.
Delete both the android/ and ios/ folder.
Change the "name" entry in your package.json to the new name.
Change the app name in both your index.android.js and index.ios.js: AppRegistry.registerComponent('NewAppName', () => App);
Run react-native upgrade to re-generate the platform subfolders.
If you have linked resources (like custom fonts etc.) run react-native link.
If you have other generated resources (like app icons) run the scripts to generate them (e.g. yo).
Finally, uninstall the old app on each device and run the new one.
Hope it helps. feel free for doubts
Upvotes: 3