2

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)

enter image description here

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

enter image description here

Does anyone have the same scenario? How to achieve this?

Thanks

2
  • 1
    Did you achieve this finally? Commented Aug 26, 2020 at 8:03
  • Any update on this? Commented Jan 12 at 4:36

1 Answer 1

2

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.

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

1 Comment

Unable to use ' use_native_modules!' if we seperate the project folders. Is there any update for this?

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.