Skip to content

Commit b69041f

Browse files
JoshuaGrossfacebook-github-bot
authored andcommitted
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
1 parent 33ed358 commit b69041f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import com.facebook.react.bridge.WritableMap;
4040
import com.facebook.react.bridge.WritableNativeMap;
4141
import com.facebook.react.common.annotations.VisibleForTesting;
42+
import com.facebook.react.config.ReactFeatureFlags;
4243
import com.facebook.react.modules.appregistry.AppRegistry;
4344
import com.facebook.react.modules.core.DeviceEventManagerModule;
4445
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
@@ -437,13 +438,14 @@ public void unmountReactApplication() {
437438
// to be committed via the Scheduler, which will cause mounting instructions
438439
// to be queued up and synchronously executed to delete and remove
439440
// all the views in the hierarchy.
440-
if (mReactInstanceManager != null) {
441+
if (mReactInstanceManager != null && ReactFeatureFlags.enableStopSurfaceOnRootViewUnmount) {
441442
final ReactContext reactApplicationContext = mReactInstanceManager.getCurrentReactContext();
442443
if (reactApplicationContext != null && getUIManagerType() == FABRIC) {
443444
@Nullable
444445
UIManager uiManager =
445446
UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType());
446447
if (uiManager != null) {
448+
FLog.e(TAG, "stopSurface for surfaceId: " + this.getId());
447449
uiManager.stopSurface(this.getId());
448450
}
449451
}

ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,7 @@ public class ReactFeatureFlags {
8989

9090
/** Feature flag to have FabricUIManager teardown stop all active surfaces. */
9191
public static boolean enableFabricStopAllSurfacesOnTeardown = false;
92+
93+
/** Feature flag to use stopSurface when ReactRootView is unmounted. */
94+
public static boolean enableStopSurfaceOnRootViewUnmount = false;
9295
}

0 commit comments

Comments
 (0)