├── LICENSE └── README.md /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Renaming a React Native project 2 | Describes the steps needed to rename a React Native project. Pull requests welcome! 3 | 4 | ## Steps 5 | 6 | ### 1. Ensure you have a clean repository. 7 | 8 | Check in any outstanding changes - you'll want to start with a clean slate. 9 | 10 | ### 2. Delete all build directories 11 | 12 | `rimraf android/app/build android/build ios/build` 13 | 14 | ### 3. Delete all directories named with the old project name 15 | 16 | This includes `ios/oldProjectName*` and `android/app/src/main/java/com/oldProjectName`. The upgrade will create new directories with the new project name. 17 | 18 | ### 4. Rename the project at the top of package.json 19 | 20 | { 21 | "name": "newProjectName", 22 | 23 | Note that **[You can't use kebob-case]**(https://github.com/facebook/react-native/issues/213). Make it camelCase. 24 | 25 | ### 5. Run `react-native upgrade` 26 | 27 | Overwrite all files as requested. If you have customizations in your project, you'll go back and fix them. 28 | 29 | ### 6. Update AppRegistry.registerComponent 30 | 31 | In your main app file (e.g. App.tsx): 32 | 33 | `AppRegistry.registerComponent("newProjectName", () => App);` 34 | 35 | While you're at it, check that you like your main `Component` name: 36 | 37 | export default class MyNewShinyApp extends Component { 38 | 39 | ### 7. Run `react-native link` 40 | 41 | Additionally, do this also for any native projects you have, e.g. `react-native link react-native-codepush` and `react-native-link react-native-auth0`. 42 | 43 | ### 8. Bring forward any customizations in your info.plist file 44 | 45 | Particularly: 46 | 47 | CFBundleDisplayName 48 | New Friendly App Name 49 | 50 | Also including any other customizations you may have, like `UIBackgroundModes`. 51 | 52 | ### 9. Update app name for Android in strings.xml 53 | 54 | New Friendly App Name 55 | 56 | ### 10. Rename target on first line of Podfile 57 | 58 | target 'newProjectName' do 59 | 60 | ### 11. Bring forward any other changes to overwritten files 61 | 62 | Check your deleted files in git vs the new ones (diffing helps), particularly: 63 | 64 | .gitignore 65 | android/settings.gradle 66 | android/app/build.gradle 67 | android/app/google-services.json 68 | android/app/src/main/AndroidManifest.xml 69 | android/app/src/main/java/com/newProjectName/MainApplication.java 70 | 71 | And display name in `app.json` 72 | 73 | ### 12. Additional steps 74 | 75 | - Restart RN packager 76 | - Rename git repository (our local repository automatically picked up the change) 77 | - Rename local directory and update links/shortcuts/aliases 78 | 79 | ### Notes 80 | 81 | - The `react-native-rename` project has been mentioned on Stackoverflow, though we haven't used it. 82 | - Here's an article for [renaming apps created with Expo](https://medium.com/the-react-native-log/how-to-rename-a-react-native-app-dafd92161c35). 83 | 84 | ### Initial sources 85 | 86 | - https://stackoverflow.com/a/34248445/152711 87 | - http://blog.tylerbuchea.com/renaming-a-react-native-project/ 88 | - [Chain React 2017: From Idea to App Store: A Guide to Shipping React Native Apps by Chris Ball](https://www.youtube.com/watch?v=W8X7t1qlT_w) 89 | 90 | --- 91 | 92 | Sponsored by [2 Minute Revolution](https://2minute.com). 93 | --------------------------------------------------------------------------------