Feature-flag gate stopSurface on root view unmount

Summary:
Gate stopSurface behind a feature flag.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D22054480

fbshipit-source-id: 3ea48ab46aeb3532fc7a3dd83659d7c32891ec06
This commit is contained in:
Joshua Gross
2020-06-15 18:43:30 -07:00
committed by Facebook GitHub Bot
parent 33ed358330
commit b69041f086
2 changed files with 6 additions and 1 deletions
@@ -39,6 +39,7 @@ import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.bridge.WritableNativeMap;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.modules.appregistry.AppRegistry;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
@@ -437,13 +438,14 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
// to be committed via the Scheduler, which will cause mounting instructions
// to be queued up and synchronously executed to delete and remove
// all the views in the hierarchy.
if (mReactInstanceManager != null) {
if (mReactInstanceManager != null && ReactFeatureFlags.enableStopSurfaceOnRootViewUnmount) {
final ReactContext reactApplicationContext = mReactInstanceManager.getCurrentReactContext();
if (reactApplicationContext != null && getUIManagerType() == FABRIC) {
@Nullable
UIManager uiManager =
UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType());
if (uiManager != null) {
FLog.e(TAG, "stopSurface for surfaceId: " + this.getId());
uiManager.stopSurface(this.getId());
}
}