private void tearDownReactContext(ReactContext reactContext) { UiThreadUtil.assertOnUiThread(); if (mLifecycleState == LifecycleState.RESUMED) { reactContext.onPause(); } for (ReactRootView rootView : mAttachedRootViews) { detachViewFromInstance(rootView, reactContext.getCatalystInstance()); } reactContext.onDestroy(); mDevSupportManager.onReactInstanceDestroyed(reactContext); mMemoryPressureRouter.onReactInstanceDestroyed(); }
@Override public void onDestroy() { UiThreadUtil.assertOnUiThread(); if (mReactContextInitAsyncTask != null) { mReactContextInitAsyncTask.cancel(true); } mMemoryPressureRouter.destroy(mApplicationContext); if (mUseDeveloperSupport) { mDevSupportManager.setDevSupportEnabled(false); } if (mCurrentReactContext != null) { mCurrentReactContext.onDestroy(); mCurrentReactContext = null; mHasStartedCreatingInitialContext = false; } mCurrentActivity = null; }