Embedding React Native components into platform native code?

I've been trying to investigate a question for a while. I found a couple of articles:

https://facebook.github.io/react-native/docs/embedded-app-ios.html#content https://facebook.github.io/react-native/docs/embedded-app-android.html#content

They say that you can include your React Native code in a native application. Did I understand it right? If so, there are still many questions:

In short, does this idea — to write some library or UI component using React Native and to allow developers include it in their native apps via suggested mechanisms — seem reasonable or nobody would do that?

Upvotes: 2

Views: 715

Answers (1)

John Shammas
John Shammas

Reputation: 2715

Yes, it will work offline.

React Native does not provide any method for you to communicate with native code out of the box. You will need to build a React Native plugin that calls specific Objective-C or Java methods you wish to invoke.

From a very simple app I am seeing around ~50MB in memory usage, but this will vary wildly depending on what your project contains. React Native is simply creating native platform-specific views, so the more complex your project, the larger the memory usage. React Native is relatively light and in the single-digits of MB size, but again, this will vary greatly.

Overall, the resource intensity will likely be far greater using React Native than coding something natively, and will be far more difficult to interact with from native code.

Upvotes: 1

Related Questions