Upgrading App to Latest Version of React Native Windows
Upgrading A React Native Windows App
Upgrading your app to new React Native Windows versions requires a small amount of effort, but we will try to streamline this process for you as much as possible in this guide. You have two main options for how to upgrade your React Native Windows app. You can use the React Native Windows CLI or manually upgrade using Upgrade Helper.
Steps to Upgrade An App to New React Native Windows Version via CLI
In the root of your project, run
npx react-native-windows-init --version 0.XX.X --overwrite
.In the root of your project, run
npx react-native autolink-windows
to link any native modules used by your app.Step 1 will overwrite any changes you previously made to the native Windows code of your project and generate a new GUID. If you made changes to this code or wish to keep your previous GUID, you have two options:
- Add those changes manually.
- If your project is a Git repository, open the project in Visual Studio Code and navigate to the Source Control tab. There, you can undo the specific overwrite edits that erased your changes.
The upgrade script will not remove any files that were removed from the new template. To check if there are any files that require manual deletion, use Upgrade Helper. See the section below for the steps on how to use this tool.
Your app is now ready to build!
Steps to Manually Upgrade An App to New React Native Windows Version via Upgrade Helper
- Open Upgrade Helper in your preferred browser.
- Select the React Native Windows version your app is currently on and the version you wish to upgrade to. By default, the latest major versions are selected.
- Select the "Show me how to upgrade" button.
- Manually edit your app source to match the changes displayed in Upgrade Helper.
- Run
yarn
at the root of your project to update your dependencies. - Your app is now ready to build!