Revert D59566611: Fix Android removeClippedSubviews in horizontal ScrollView in RTL

Differential Revision:
D59566611

Original commit changeset: a2eb12b984dc

Original Phabricator Diff: D59566611

fbshipit-source-id: 144c479c264b8f1ca25a571ae73cc0db241e075d
This commit is contained in:
Nick Gerleman
2024-07-11 20:52:29 -07:00
committed by Facebook GitHub Bot
parent 3f8340975b
commit d68a1771f0
3 changed files with 26 additions and 6 deletions
@@ -6646,6 +6646,7 @@ public class com/facebook/react/views/scroll/ReactHorizontalScrollContainerView
public fun <init> (Landroid/content/Context;)V
public fun getLayoutDirection ()I
protected fun onLayout (ZIIII)V
public fun setRemoveClippedSubviews (Z)V
}
public final class com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager : com/facebook/react/views/view/ReactClippingViewManager {
@@ -7933,6 +7934,7 @@ public class com/facebook/react/views/view/ReactViewGroup : android/view/ViewGro
public fun onInterceptTouchEvent (Landroid/view/MotionEvent;)Z
protected fun onLayout (ZIIII)V
protected fun onMeasure (II)V
protected fun onSizeChanged (IIII)V
public fun onTouchEvent (Landroid/view/MotionEvent;)Z
public fun removeView (Landroid/view/View;)V
public fun removeViewAt (I)V
@@ -36,6 +36,21 @@ public class ReactHorizontalScrollContainerView extends ReactViewGroup {
return mLayoutDirection;
}
@Override
public void setRemoveClippedSubviews(boolean removeClippedSubviews) {
// Clipping doesn't work well for horizontal scroll views in RTL mode - in both
// Fabric and non-Fabric - especially with TextInputs. The behavior you could see
// is TextInputs being blurred immediately after being focused. So, for now,
// it's easier to just disable this for these specific RTL views.
// TODO T86027499: support `setRemoveClippedSubviews` in RTL mode
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
super.setRemoveClippedSubviews(false);
return;
}
super.setRemoveClippedSubviews(removeClippedSubviews);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (getLayoutDirection() == LAYOUT_DIRECTION_RTL) {
@@ -195,12 +195,7 @@ public class ReactViewGroup extends ViewGroup
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
// If the size or position of the view has changed it may intersect different children than
// before. If "removeClippedSubviews" is set, we must re-evaluate intersection to render newly
// visible children, and remove those no longer visible.
if (changed && mRemoveClippedSubviews) {
updateClippingRect();
}
// No-op since UIManagerModule handles actually laying out children.
}
@Override
@@ -487,6 +482,14 @@ public class ReactViewGroup extends ViewGroup
return super.getChildVisibleRect(child, r, offset);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if (mRemoveClippedSubviews) {
updateClippingRect();
}
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();