Embed react native app inside existing ios/android app

僤鯓⒐⒋嵵緔 提交于 2020-01-25 06:22:41

问题


I need to know if it is possible to "embed" a react native app within an existing ios/android app without sharing the react native app code.

We currently have a react native app which use a few plugins dependencies and was asked if it would be possible to embed it within an existing native app (i.e. as a subview) and make both parts communicate with each other.

I know it is possible to do it (https://facebook.github.io/react-native/docs/communication-ios.html) but I'm rather wondering how to achieve it without sharing our current code with the existing app that needs our app to be embedded.

Is there any way to embed it as a bundle, a widget or even grab it from a private repo while building?

Thanks


回答1:


From the documentation you linked:

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.

You can produce an iOS Framework that includes this RCTRootView. You should be able to distribute the binary framework if you don't want to distribute the source.



来源:https://stackoverflow.com/questions/51327263/embed-react-native-app-inside-existing-ios-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!