From 34ae9facd52b5da28b5ced22110532bbcdad2cec Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Mon, 10 Mar 2025 13:43:10 -0700 Subject: [PATCH] Fix issue with zIndex child removal (#49900) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49900 This appears to fix an issue where removing a sibling with zIndex breaks drawing of the next sibling. The theory is that eager return in `onViewRemoved` prevents the view from reverting into a state where it no longer uses custom draw order. However, tracing back history, this eager return was [added](https://github.com/facebook/react-native/pull/43389) to fix a bug in Reanimated. cc bartlomiejbloniarz to confirm if [this Reanimated issue](https://github.com/software-mansion/react-native-reanimated/issues/5715) resurfaces from this change. Fixes #49838 ## Changelog [Android][Fixed] Fixes issue with z-indexed sibling removal Reviewed By: NickGerleman, cipolleschi Differential Revision: D70795631 fbshipit-source-id: 500af92226be29af73f36f911ffff27a0c083ae9 --- .../java/com/facebook/react/views/view/ReactViewGroup.java | 3 --- 1 file changed, 3 deletions(-) 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 65349b852e2..57072722de6 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 @@ -594,9 +594,6 @@ public class ReactViewGroup extends ViewGroup UiThreadUtil.assertOnUiThread(); checkViewClippingTag(child, Boolean.TRUE); if (!customDrawOrderDisabled()) { - if (indexOfChild(child) == -1) { - return; - } getDrawingOrderHelper().handleRemoveView(child); setChildrenDrawingOrderEnabled(getDrawingOrderHelper().shouldEnableCustomDrawingOrder()); } else {