Update Existing React Native App from react-native version 0.6x to 0.7x
Here we will take an example to update react-native version from 0.69.4 to 0.75.0
Remove node_modules, package-lock.json and Podfile.lock
Now go to package.json and update "react" :"^x.x.x" to "react" :"^18.3.1" and "react-native" :"^0.69.4" to "react-native" :"^0.75.0"
Use https://microsoft.github.io/rnx-kit/docs/tools/align-deps#:~:text=%40rnx%2Dkit%2Falign%2D,are%20curated%20from%20real%20apps to check that your packages are using compatible dependencies and versions and update accordingly.
Use https://react-native-community.github.io/upgrade-helper/?from=0.69.4&to=0.75.4&package=com.test&name=test and get the diff and change the files accordingly.
Now run "npm i"
Now open the android folder in Android Studio and proceed to Sync Project File with Gradle.
After completion run the app using "cd android && react-native run-android"
Open projectname.xcworkspace in Xcode and wait for sync to be completed.
Now run "cd ios && pod install"
After completion run the app using "react-native run-ios"
If you get any issue in any of dependencies, go to their git repo to check the latest version and compatibility with the react-native version .
If there is a need to change inside the node_modules after change use https://www.npmjs.com/package/patch-package for patching it. So that after npm install further time no need to update the same in node modules.
- React Native Website - learn more about React Native.
- React Native Upgrade Helper Website - learn more about React Native Upgrade Helper.
- React Native Package Compatibility Website - learn more about React Native Package Compatibility.
- React Native Patch Package Website - learn more about React Native Patch package.