1

I have been using React Native for the past 4 of months working both on Android and IOS. According to React Native Docs there will be an updated version of React Native every month. So, I keep updating it every month which is good, but the problem is I am using a couple of npm packages which is getting outdated due to react-native update which in-turn causes errors in my project.

For Android, we can lock the react-native version by specifying the version number in gradle. And for the Javascript part we can lock it in package.json. But for IOS I am not able to find anything like that.

So, is there way to lock the react-native version in IOS xcode?

1 Answer 1

2

Yes, make your package.json file at root path - react-native version to fixed number. for example:

"dependencies": {
    "react-native": "0.50.4",
}

So every time you do npm install, that given version will be installed. without postfix ^ it will never be upgraded.

The react-native version of iOS is just a project / static library import from node_module/react-native/Libraries folder, via react-native link.

Update 1:

Take RCTAnimation.xcodeproj in project for example, you can find it locate at node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj.

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

If that's how it works, then do you have any idea about what is causing this error? React Native version mismatch: Javascript version: 0.50.3 Native version: 0.51.0
If that's your case -- version mismatch, you might run into this problem. stackoverflow.com/questions/47763824/…
Updated my answer about the relationship between XCode project and node_modules.
Awesome! Works great :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.