简体   繁体   中英

Best approach to upgrade react native dependencies

Recently, I joined a new company and found there are lots of outdated project dependencies eg react-navigation@2.xx, react-native-firebase, react-native etc. Now I want to upgrade all of them. Now another concern is rest of four developers are doing there on outdated packages.

So what would be the best approaches

Thanks in advance

I recently experienced the same thing. And here's how i dealt with:

You must talk to those devs and get approval for upgrade. Then you must select a day with no development to upgrade because every new commit will introduce conflict, weekend would be best.

Backup the project to multiple places, if you make something terrible, even remote git repo might not help you.

Upgrade react native first. Recent versions of libraries depends on the new technologies of react native. For example reanimated 2 requires rn > 0.62. You can use React Native Upgrade Helper to see what has changed. If your project doesn't use too much custom native code you can even create a new empty react native project and copy necessary files.

Test your app in android & ios to see upgrading react native didn't break anything.

Then look into every dependency to see what has changed. You're in luck if you can find a migration guide (something like this: https://reactnavigation.org/docs/5.x/upgrading-from-4.x ). Some libraries like react navigation, react native reanimated changed drastically. These kind of libraries would be the most of your work, especially reanimated. Test and backup project after every library.

And you should be done. Test your project again for every screen / every method. If you're 100% sure project is running as expected, you can change / create new tests and merge your changes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM