问题
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