Giter Site home page Giter Site logo

santosh-kumar-kaushal / react-native-as-an-android-lib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from glung/react-native-as-an-android-lib

0.0 0.0 0.0 119 KB

Adding a react-native library dependency to an Android app

Java 48.87% JavaScript 20.50% Starlark 30.62%

react-native-as-an-android-lib's Introduction

The repo is archived!

This is a spike UNMAINTAINED

Objective

The objective is to add react-native dependencies to a vanilla Android app. This goal being to use react-native without commiting entirely to the platform.

Benefits are :

  • Keep an exiting app setup, i.e. do not plainly move and commit to the platform.
  • Use the power of react-native :
  • To handover certain apsect of an app to non-android developerse (sign in / up for instance)
  • To prototype quickly.

Approach

Reac-native is a plaform and one may not want to move an entire app to it.

Good reasons are :

  • It has impact on the file structure, and on the IDE integration
  • The plaform is still immature

However, react-native is promissing and can already used to prototype or could even be used to integrate modules.

Pitfals

Min SDK

it has to be >= 16.

Depdency

React-native require your applicattion to implement the ReactApplication interface to run. This means that the app needs to add a dependency to 'com.facebook.react:react-native`.

The latter is a npm dependency so to work well outside of a react naive project (a project initialized with react-nmatie init and containing a folder node_modules) it has to be deployed to a maven repository.

Including this has an overhead in size :

  • 1.5M normal.apk
  • 8.5M react_native.apk
  • 7.9M react_native.apk proguarded

There is not much we can do about that since about 6M comes from react-native ndk libraries (compiled for arm64-v8a, armeabi, armeabi-v7a x86 , x86_64).

It has also an overhead in method count (w/o running proguard) :

Packaging

A little customization has been required to package the aar library (but not too bad).

apply plugin: "com.android.library"

project.ext.react = [
        bundleInDebug   : true,
        jsBundleDirDebug: "$buildDir/intermediates/bundles/debug/assets",
        jsBundleDirRelease: "$buildDir/intermediates/bundles/release/assets"
]

Alternative integrations

If the footpint is a concernt, an other alternative would be to constraint react-native to protoyping and in a specific flavor and therefore has no impact on production app.

Open questions

  • crash reporting ?

react-native-as-an-android-lib's People

Contributors

glung avatar raphaelmor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.