Reputation: 51
Currently, we have separate native iOS & native android repos. Say A & B respectively
I am trying to integrate react native in A & B.
I am referring:- https://facebook.github.io/react-native/docs/integration-with-existing-apps.html
Above tutorial is forcing me to create new directory structure with iOS,android & JS folder inside main project. Thus, allowing me to have only 1 repo (see below)
My requirement is: 1)I don't want to hamper directory structure of existing android & iOS repos 2)Can we have separate JS repo "C" ?
See below
Does anyone have the same scenario? How to achieve this?
Thanks
Upvotes: 2
Views: 274
Reputation: 687
This is very possible. We currently use a similar scenario in production. We have an Android repo A and an iOS repo B. We created a separate React Native repo C. A depends on C through a maven dependency. B depends on C through a cocoapod dependency.
The tricky part is to specify the path when building your dependencies. For example in iOS the official docs state this in the podfile:
pod 'React', :path => '../node_modules/react-native', :subspecs => [
In our case it is something like
pod 'React', :path => '/../YourReactNativeApp/node_modules/react-native', :subspecs => [
And then when you checkout your React Native repo, in our case, we must make sure that the folder checked out is adjacent to our our iOS project folder.
Upvotes: 2