在现有 ios/android 应用程序中嵌入 React 本机应用程序

Embed react native app inside existing ios/android app

我想知道是否可以在现有 ios/android 应用中 "embed" React 本机应用而不共享本机应用代码。

我们目前有一个使用一些插件依赖项的 React 本机应用程序,并被问及是否可以将其嵌入现有的本机应用程序(即作为子视图)并使两个部分相互通信。

我知道可以做到 (https://facebook.github.io/react-native/docs/communication-ios.html),但我想知道如何在不与需要嵌入我们的应用程序的现有应用程序共享我们当前代码的情况下实现它。

有没有什么方法可以将它作为一个包、一个小部件嵌入,甚至在构建时从私人仓库中获取它?

谢谢

根据您链接的文档:

In order to embed a React Native view in a native component, we use RCTRootView. RCTRootView is a UIView that holds a React Native app. It also provides an interface between native side and the hosted app.

您可以生成包含此 RCTRootView 的 iOS 框架。如果您不想分发源代码,您应该能够分发二进制框架。