Andrew Andrew - 1 year ago 57
iOS Question

Integrating a React Native Library into existing native iOS / Android application

A bit of context: I'd like to build a View library that developers can include in their existing iOS and Android applications. The view I'm creating is a button, and when clicked, creates a dialog / modal in the application which shows some data fetched from my server. The view itself, fetching the data from my server, and creating the dialog should all be built into react native library. The developer of the application should just need to import my library and put the button view in their application.

My question: How can I create a library in react native for my button, and minimize the amount of burden on the application developer that wants to include it? Does the application developer absolutely need to install react-native dependencies themselves, or is react-native able to compile into native code that the app developer can just import into their project like any other native library?

Answer Source

There is no way to build a React Native library without having all React Native stuff involved.

minimize the amount of burden on the application developer that wants to include it

If you want to make a library for RN applications, you can do it the way you described - in JavaScript with RN framework. It would be the easiest way for RN developers. However I don't think that the most of the native developers embrace the idea of including all the React Native dependencies (600+) to add a single library. If you would like to make a shared logic among platforms (iOS and Android) you better do it in C/C++ language.

Please be advised that it's my personal opinion as a developer with 4 years of practical experience in Android/iOS platforms.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download