SHARE
TWEET

Untitled

a guest Jun 19th, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top