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 install react-native-modal-android --save
- 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
MIT