[英]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). 我刚刚在react-native(RN)中创建了一个Android应用程序。 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. 我经历了这样的问题,并配置android构建变体链接。 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/.
他们讨论了如何在不同的源集中(例如src / demoDebug /,src / debug /,src / demo /和src / main /)创建新模块,gradle配置和组织Java代码。
I don't think this will work with react-native because the entry point of RN app is index.android.js. 我认为这不适用于react-native,因为RN应用程序的入口点是index.android.js。 For 2 apps to work out of the same project we need 2 entry points.
为了使2个应用程序可以在同一个项目中运行,我们需要2个入口点。 Is there a way to define multiple entry points in a RN android app?
有没有一种方法可以在RN android应用中定义多个入口点? Does RN support this?
RN支持吗? If yes, how to organize files of the two apps in the same project?
如果是,如何组织同一项目中两个应用程序的文件?
您可以创建git子模块并将所有共享代码移至其中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.