mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Create ReactFeatureFlag to enable / disable custom implementation of getChildVisibleRect
Summary: This diff introduces a new ReactFeatureFlag that will be used to enable / disable a custom implementation of getChildVisibleRect in the classes ReactViewGroup, ReactHorizontalScrollView and ReactScrollView. The new ReactFeatureFlag is disabled by default bevause of T57363204 This is disabling the code landed as part of D17782658 / https://github.com/facebook/react-native/pull/26334 Changelog: Introduce ReactFeatureFlag to disable custom implementation of getChildVisibleRect (disabled by default) This will disable the custom algorithm created on https://github.com/facebook/react-native/pull/26334 Reviewed By: yungsters Differential Revision: D18621042 fbshipit-source-id: 35ca3417b596117b47edab29515a824c1726c2ce
This commit is contained in:
committed by
Facebook Github Bot
parent
77ba82a6e1
commit
9c61693c9e
@@ -78,4 +78,16 @@ public class ReactFeatureFlags {
|
||||
* TODO T54997838: remove as followup
|
||||
*/
|
||||
public static boolean allowDisablingImmediateExecutionOfScheduleMountItems = false;
|
||||
|
||||
/**
|
||||
* This react flag enables a custom algorithm for the getChildVisibleRect() method in the classes
|
||||
* ReactViewGroup, ReactHorizontalScrollView and ReactScrollView.
|
||||
*
|
||||
* <p>This new algorithm clip child rects if overflow is set to ViewProps.HIDDEN. More details in
|
||||
* https://github.com/facebook/react-native/issues/23870 and
|
||||
* https://github.com/facebook/react-native/pull/26334
|
||||
*
|
||||
* <p>The react flag is disabled by default because this is increasing ANRs (T57363204)
|
||||
*/
|
||||
public static boolean clipChildRectsIfOverflowIsHidden = false;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ rn_android_library(
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
react_native_target("java/com/facebook/react/config:config"),
|
||||
react_native_target("java/com/facebook/react/module/annotations:annotations"),
|
||||
react_native_target("java/com/facebook/react/modules/i18nmanager:i18nmanager"),
|
||||
react_native_target("java/com/facebook/react/touch:touch"),
|
||||
|
||||
+4
-2
@@ -25,6 +25,7 @@ import androidx.core.text.TextUtilsCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.uimanager.MeasureSpecAssertions;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroup;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
|
||||
@@ -494,8 +495,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
||||
|
||||
@Override
|
||||
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
|
||||
return ReactClippingViewGroupHelper.getChildVisibleRectHelper(
|
||||
child, r, offset, this, mOverflow);
|
||||
return ReactFeatureFlags.clipChildRectsIfOverflowIsHidden
|
||||
? ReactClippingViewGroupHelper.getChildVisibleRectHelper(child, r, offset, this, mOverflow)
|
||||
: super.getChildVisibleRect(child, r, offset);
|
||||
}
|
||||
|
||||
private int getSnapInterval() {
|
||||
|
||||
@@ -24,6 +24,7 @@ import androidx.core.view.ViewCompat;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.common.ReactConstants;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.uimanager.MeasureSpecAssertions;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroup;
|
||||
import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
|
||||
@@ -345,8 +346,9 @@ public class ReactScrollView extends ScrollView
|
||||
|
||||
@Override
|
||||
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
|
||||
return ReactClippingViewGroupHelper.getChildVisibleRectHelper(
|
||||
child, r, offset, this, mOverflow);
|
||||
return ReactFeatureFlags.clipChildRectsIfOverflowIsHidden
|
||||
? ReactClippingViewGroupHelper.getChildVisibleRectHelper(child, r, offset, this, mOverflow)
|
||||
: super.getChildVisibleRect(child, r, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ rn_android_library(
|
||||
react_native_dep("third-party/java/jsr-305:jsr-305"),
|
||||
react_native_target("java/com/facebook/react/bridge:bridge"),
|
||||
react_native_target("java/com/facebook/react/common:common"),
|
||||
react_native_target("java/com/facebook/react/config:config"),
|
||||
react_native_target("java/com/facebook/react/module/annotations:annotations"),
|
||||
react_native_target("java/com/facebook/react/touch:touch"),
|
||||
react_native_target("java/com/facebook/react/views/common:common"),
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.UiThreadUtil;
|
||||
import com.facebook.react.common.annotations.VisibleForTesting;
|
||||
import com.facebook.react.config.ReactFeatureFlags;
|
||||
import com.facebook.react.modules.i18nmanager.I18nUtil;
|
||||
import com.facebook.react.touch.OnInterceptTouchEventListener;
|
||||
import com.facebook.react.touch.ReactHitSlopView;
|
||||
@@ -433,8 +434,9 @@ public class ReactViewGroup extends ViewGroup
|
||||
|
||||
@Override
|
||||
public boolean getChildVisibleRect(View child, Rect r, android.graphics.Point offset) {
|
||||
return ReactClippingViewGroupHelper.getChildVisibleRectHelper(
|
||||
child, r, offset, this, mOverflow);
|
||||
return ReactFeatureFlags.clipChildRectsIfOverflowIsHidden
|
||||
? ReactClippingViewGroupHelper.getChildVisibleRectHelper(child, r, offset, this, mOverflow)
|
||||
: super.getChildVisibleRect(child, r, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user