Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
  2. private ReactRootView mReactRootView;
  3. private ReactInstanceManager mReactInstanceManager;
  4.  
  5. @Override
  6. protected void onCreate(Bundle savedInstanceState) {
  7. super.onCreate(savedInstanceState);
  8.  
  9. mReactRootView = new ReactRootView(this);
  10. mReactInstanceManager = ReactInstanceManager.builder()
  11. .setApplication(getApplication())
  12. .setCurrentActivity(this)
  13. .setBundleAssetName("index.android.bundle")
  14. .setJSMainModulePath("index")
  15. .addPackage(new MainReactPackage())
  16. .setUseDeveloperSupport(BuildConfig.DEBUG)
  17. .setInitialLifecycleState(LifecycleState.RESUMED)
  18. .build();
  19. // The string here (e.g. "MyReactNativeApp") has to match
  20. // the string in AppRegistry.registerComponent() in index.js
  21. mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);
  22.  
  23. setContentView(mReactRootView);
  24. }
  25.  
  26. @Override
  27. public void invokeDefaultOnBackPressed() {
  28. super.onBackPressed();
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement