Skip to content

scrollback/react-native-appvirality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-appvirality

A React Native module to show system Image chooser. Currently only supports Android.

Installation

npm i --save react-native-appvirality

Add it to your android project

In android/settings.gradle

...

include ':react-native-appvirality'
project(':react-native-appvirality').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-appvirality/android')

In android/app/build.gradle

...

dependencies {
    ...

    compile project(':react-native-appvirality')
}

Register module (in MainActivity.java)

import android.content.Intent;  // <--- import
import io.scrollback.AppviralityPackage;  // <--- import

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......

  private AppviralityPackage mChoosersPackage = new AppviralityPackage(this); // <------ create new instance

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new AppviralityPackage(this)) // <------ add the package
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "ExampleApp", null);

    setContentView(mReactRootView);
  }

  ......

}

Usage

First import the module as follows:

import React from "react-native";

const {
  NativeModules: {
    AppviralityModule
  }
} = React;

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages