From 958f10838af844d7e6b3eb0d9abc092c71610e7b Mon Sep 17 00:00:00 2001 From: Thomas Nardone Date: Thu, 19 Dec 2024 08:12:44 -0800 Subject: [PATCH] Restore subclipping view removal (#48329) Summary: With the call to `removeView()` removed from `ReactViewClippingManager` in https://github.com/facebook/react-native/pull/47634, we're seeing views erroneously sticking around in the layout. While `removeViewWithSubviewClippingEnabled()` calls `removeViewsInLayout()`, it does not trigger the corresponding side effects of [removeView()](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r9/core/java/android/view/ViewGroup.java#5501): ``` public void removeView(View view) { if (removeViewInternal(view)) { --> requestLayout(); --> invalidate(true); } } ``` To compensate, flip `removeViewsInLayout()` to [`removeViews()`](https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-15.0.0_r9/core/java/android/view/ViewGroup.java#5562), which will ensure layout. Changelog: [Android][Fixed] Restore layout/invalidate during ReactViewClippingManager.removeViewAt() Reviewed By: javache Differential Revision: D67398971 --- .../main/java/com/facebook/react/views/view/ReactViewGroup.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index ea1da3f503944e..da20629d4faec9 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -749,6 +749,7 @@ public void run() { } } removeViewsInLayout(index - clippedSoFar, 1); + invalidate(); } removeFromArray(index); }