Renaming a React Native Project


Change the name of your project in your package.json under the "name" field. Then run:

react-native upgrade  

Update AppRegistry

Make sure you change the references in your index files

AppRegistry.registerComponent('NewProjectName', () => NewProjectName);  

Remove Old Project Files, Folders, & References

You may find that after the step above the react-native command fails with PCH issues

Error PCH was compiled with module cache path  

This is because you have references, folders, and files hanging around from the old project namespace.

iOS Resolution

Delete the old project folders

rm -rf ios/build  
rm -rf ios/OldProjectName  
rm -rf ios/OldProjectNameTests  
rm -rf ios/OldProjectName.xcodeproj  

Android Resolution

Delete the old project folder

rm -rf android/app/src/main/java/com/OldProjectName  

Change references in these 4 files

You will find references to your old project name in these files. You can do a global search and replace in the ./android folder to make life easier. There aren't that many references though and doing it by hand isn't hard.


Clean Project

Clear cached references

You may have some cached references hanging around in Xcode. To resolve this simply open Xcode hold down the Option key and from the system toolbar choose Product > Clean Build Folder


Everything should be working now. Run your app and try it out.

react-native run-ios  
# OR
react-native run-android  


A set of UI components for React Native.
Get Carbon Native!