Last active
March 18, 2018 19:40
-
-
Save dvrajan/720c16479b9aa1e60872540b7c8be2b0 to your computer and use it in GitHub Desktop.
Blogpost example ReactScreen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ReactScreen extends Activity implements DefaultHardwareBackBtnHandler { | |
protected ReactInstanceManager reactInstanceManager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
reactInstanceManager = ReactInstanceManager.builder() | |
.setApplication(this.getApplication()) | |
.setBundleAssetName("react.android.bundle") | |
.setJSMainModulePath("index") | |
.addPackage(new MainReactPackage()) | |
.setUseDeveloperSupport(BuildConfig.DEBUG) | |
.setInitialLifecycleState(LifecycleState.RESUMED) | |
.build(); | |
ReactRootView reactRootView = new ReactRootView(this); | |
reactRootView.startReactApplication(reactInstanceManager, "Index"); | |
setContentView(reactRootView); | |
} | |
@Override | |
public void invokeDefaultOnBackPressed() { | |
super.onBackPressed(); | |
} | |
//Implement other lifecycle methods here and delegate to ReactInstanceManager | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment