Add a React Feature Flag to control TextInlineView fix

Summary:
This diff adds a temporary Feature Flag to control a fix in TextInlineView (see previous diffs of the stack)

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20812920

fbshipit-source-id: 90fece9b29ba173546d96e4d9baf1ccabb3031b2
This commit is contained in:
David Vacca
2020-04-02 14:07:29 -07:00
committed by Facebook GitHub Bot
parent 21eb540d6e
commit 3ed1b1f4ff
3 changed files with 26 additions and 1 deletions
@@ -67,4 +67,10 @@ public class ReactFeatureFlags {
* <p>The react flag is disabled by default because this is increasing ANRs (T57363204)
*/
public static boolean clipChildRectsIfOverflowIsHidden = false;
/**
* Temporary feature flat to control a fix in the transition to layoutOnlyViews TODO T61185028:
* remove this when bug is fixed
*/
public static boolean enableTransitionLayoutOnlyViewCleanup = false;
}
@@ -9,9 +9,11 @@ package com.facebook.react.uimanager;
import android.util.SparseBooleanArray;
import androidx.annotation.Nullable;
import com.facebook.common.logging.FLog;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.config.ReactFeatureFlags;
/**
* Class responsible for optimizing the native view hierarchy while still respecting the final UI
@@ -46,6 +48,8 @@ import com.facebook.react.bridge.ReadableMapKeySetIterator;
*/
public class NativeViewHierarchyOptimizer {
private static final String TAG = "NativeViewHierarchyOptimizer";
private static class NodeIndexPair {
public final ReactShadowNode node;
public final int index;
@@ -421,6 +425,18 @@ public class NativeViewHierarchyOptimizer {
// Bit of a hack: we need to update the layout of this node's children now that it's no longer
// layout-only, but we may still receive more layout updates at the end of this batch that we
// don't want to ignore.
if (ReactFeatureFlags.enableTransitionLayoutOnlyViewCleanup) {
FLog.i(
TAG,
"Transitioning LayoutOnlyView - tag: "
+ node.getReactTag()
+ " - rootTag: "
+ node.getRootTag()
+ " - hasProps: "
+ (props != null)
+ " - tagsWithLayout.size: "
+ mTagsWithLayoutVisited.size());
}
Assertions.assertCondition(mTagsWithLayoutVisited.size() == 0);
applyLayoutBase(node);
for (int i = 0; i < node.getChildCount(); i++) {
@@ -21,6 +21,7 @@ import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.config.ReactFeatureFlags;
import com.facebook.react.modules.i18nmanager.I18nUtil;
import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener;
import com.facebook.react.uimanager.events.EventDispatcher;
@@ -920,7 +921,9 @@ public class UIImplementation {
}
}
cssNode.markUpdateSeen();
mNativeViewHierarchyOptimizer.onViewUpdatesCompleted(cssNode);
if (ReactFeatureFlags.enableTransitionLayoutOnlyViewCleanup) {
mNativeViewHierarchyOptimizer.onViewUpdatesCompleted(cssNode);
}
}
public void addUIBlock(UIBlock block) {