Monday, June 18, 2018

What is the recommended way to update project.pbxproj file for the app while upgrading react-native version

Leave a Comment

I am using rn-diff to upgrade react-native version for my app. Sometimes, the project.pbxproj is updated to contain some new dependencies or updates to the existing dependencies. What is the recommended way to update this file? I don't think that I can just copy and paste the changes shown in the diff because it may create some duplicates or create some conflicting entries in the file.

For example, below link contains changes made to the project.pbxproj file while changing from version 0.54.4 to 0.55.0. There are a lot changes to the project.pbxproj file and I am not sure if I am supposed to copy them over or I should rather be updating some dependencies myself in Xcode.

https://github.com/ncuillery/rn-diff/compare/rn-0.54.4...rn-0.55.0

2 Answers

Answers 1

Please take a look at Upgrading to new React Native versions for upgrading your react native version!

Also if you want to update all of your dependencies, you can:

npm i -g npm-check-updates ncu -u npm install 

And there is a library called npm-check-updates which:

Find newer versions of package dependencies than what your package.json or bower.json allows!

Answers 2

In such cases I'm usually sad that I need to do this terrible thing ;) But being serious: sadly going through RN Diff is like the very best thing that you can do now (unless you have NOT detached Expo.io but then you wouldn't probably ask here). So basically you go through each change that happened between your version and version to which you want to update and copy paste the changes in these files. As rarely you can apply patches (because your project file will be so different that there is no way that it will work out correctly).

My way of doing it is: - see what changed - see code block next to it, that is somehow easy to find out in my code (like some block of code that has unique ID + few properties around e.g. can be some native modules that are always there like TEXT or View or whatever, something which is always in RN) - find the same element in my code and paste the new code above / below that code that was the same

Rinse and repeat

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment