Skip to content

iwater/react-native-modal-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-native-modal-android

The component has the same API as on iOS - http://facebook.github.io/react-native/docs/modal.html#content The animated prop is not implemented yet. I just wrap that PR code which will ship with react-native The origin author is satya164 @ https://github.com/satya164

npm version npm downloads npm licence

Installation

npm install react-native-modal-android --save

Add it to your android project

  • In android/setting.gradle
...
include ':react-native-modal-android', ':app'
project(':react-native-modal-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-modal-android')
  • In android/app/build.gradle
...
dependencies {
  ...
  compile project(':react-native-modal-android')
}
  • Register Module (in MainActivity.java)
import cn.tuofeng.modalhost.ReactModalHostPackage;  // <--- import

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

  @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 ReactModalHostPackage()) // <------ add this line to yout MainActivity class
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

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

    setContentView(mReactRootView);
  }

  ......

}

More info here: facebook/react-native#5320

License

MIT

About

The <Modal /> component has the same API as on iOS - http://facebook.github.io/react-native/docs/modal.html#content

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published