Giter Site home page Giter Site logo

react-native-apphub's Introduction

A react-native module that wraps the native Apphub SDK (https://apphub.io/). Currently, only support iOS.

Why?

AppHub is a great tool to dynamically update react native apps, and it provides very clean APIs. However, since the majority of development (including logging) should be done in JS, it will be nice to control this updating function also in JS.

How?

This RN library provides APIs including initAppHub, fetchNewBuild (Promise), and setServer (for self host).

Installing The Library

npm install --save react-native-apphub

Installing The Dependency

npm install --save apphub

Automatic Installation

  1. react-native link apphub or npm install -g rnpm && rnpm link apphub
  2. react-native link ract-native-apphub or npm install -g rnpm && rnpm link react-native-apphub

Configuration (AppHub Native SDK)

Connect Your App to AppHub (Example: AppDelegate.m)

Import AppHub at the beginning of AppDelegate.m (in Swift, add this line to your bridging header)

#import "AppHub.h"

Add the following before creating an RCTRootView (most likely in AppDelegate.m). Leave this code commented while you are developing your app. Uncomment it when you are ready to distribute to test users and deploy to the App Store

/**
 * OPTION 3 - AppHub
 *
 * Load cached code and images from AppHub.
 *
 */

AHBuild *build = [[AppHub buildManager] currentBuild];
jsCodeLocation = [build.bundle URLForResource:@"main"
                                withExtension:@"jsbundle"];

Usage

import RNAppHub from 'react-native-apphub'; // Import package from node modules

// Init AppHub
// For self hosted app
// RootURL: AppHub Server
// ApplicationID: Unique app id
RNAppHub.initAppHubWithServer('RootURL', 'ApplicationID');

// For using AppHub service
// RNAppHub.initAppHub('ApplicationID');

// Poll New app bundle
RNAppHub.fetchBuild();

API Reference

AppHub Native SDK

react-native-apphub's People

Contributors

huangbow avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jasonmore

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.