How to get the version of react-native in native code?
For some reason I need to request different URLs with different react-native versions, is there a convenient way to get the version in my Objective-C code?
You could use package.json from {project}/node_modules/react-native/package.json. It should always be available and it does have the version of the used react-native.
But I don't think that you should depend on a version number of react-native in Objective-C. I personally would prefer to check for the existence of code I wanted to use, but of course it can be different I your use case.
@DannyvanderJagt the package.json will not be available when my app is published.
I use the version to make sure my native code and remote JS code are of same version.
See this: #1732
@cxfeng1 - that should just be pulled into the bundle if you require it