Abhishek Nalin
Abhishek Nalin

Reputation: 4597

How do I structure my react-native JS code to have multiple android apps in the same project?

I just finished creating an android app in react-native (RN). I need to create another app now. A lot of code is same across both apps. I want to create the second app within the same project and reuse all the common components rather than duplicating them.

I went through this SO question and configure android build variants link. They talk about how to create a new module, gradle config and organization of java code in different source sets like src/demoDebug/, src/debug/, src/demo/ and src/main/.

I don't think this will work with react-native because the entry point of RN app is index.android.js. For 2 apps to work out of the same project we need 2 entry points. Is there a way to define multiple entry points in a RN android app? Does RN support this? If yes, how to organize files of the two apps in the same project?

Upvotes: 0

Views: 547

Answers (1)

stereodenis
stereodenis

Reputation: 3745

you can create git submodule and move all shared code to it

Upvotes: 1

Related Questions