Created
January 22, 2020 15:41
-
-
Save ferrannp/6f87f71a50b3d062af8c40c6b214fe8f to your computer and use it in GitHub Desktop.
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
// MainActivity.java | |
@Override | |
protected ReactActivityDelegate createReactActivityDelegate() { | |
return new ReactActivityDelegate(this, getMainComponentName()) { | |
@Override | |
protected ReactRootView createRootView() { | |
return new RNGestureHandlerEnabledRootView(MainActivity.this); | |
} | |
@Override | |
protected void loadApp(String appKey) { | |
if (mReactRootView != null) { | |
throw new IllegalStateException("Cannot loadApp while app is already running."); | |
} | |
mReactRootView = createRootView(); | |
mReactRootView.startReactApplication( | |
getReactNativeHost().getReactInstanceManager(), | |
appKey, | |
getLaunchOptions()); | |
} | |
@Override | |
protected void onDestroy() { | |
if (mReactRootView != null) { | |
mReactRootView.unmountReactApplication(); | |
mReactRootView = null; | |
} | |
if (getReactNativeHost().hasInstance()) { | |
getReactNativeHost().getReactInstanceManager().onHostDestroy(getPlainActivity()); | |
} | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment