Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
- private ReactRootView mReactRootView;
- private ReactInstanceManager mReactInstanceManager;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mReactRootView = new ReactRootView(this);
- mReactInstanceManager = ReactInstanceManager.builder()
- .setApplication(getApplication())
- .setCurrentActivity(this)
- .setBundleAssetName("index.android.bundle")
- .setJSMainModulePath("index")
- .addPackage(new MainReactPackage())
- .setUseDeveloperSupport(BuildConfig.DEBUG)
- .setInitialLifecycleState(LifecycleState.RESUMED)
- .build();
- // The string here (e.g. "MyReactNativeApp") has to match
- // the string in AppRegistry.registerComponent() in index.js
- mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);
- setContentView(mReactRootView);
- }
- @Override
- public void invokeDefaultOnBackPressed() {
- super.onBackPressed();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement