From 0649717a3df7a8ecd6917cc2e03d301fc18922bf Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Fri, 16 Jan 2026 08:38:46 -0800 Subject: [PATCH] Prevent view collapsing when pointerEvents is 'box-only' (#55185) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/55185 Changelog: [Internal] This change ensures that views with `pointerEvents` set to `'box-only'` are not collapsed, preserving the parent-children relationship in the view hierarchy. This is necessary because when `important_for_interaction` is applied on a view with `pointerEvents='box-only'`, the view must remain in the hierarchy to correctly signal to the gaze system that its children are not important for interaction. Without this fix, the view could be collapsed during flattening, breaking the propagation of the `important_for_interaction` property to descendant views. Reviewed By: javache Differential Revision: D90772188 fbshipit-source-id: 6a6a408845ebd1f86e420f5309160e7a6b3a9715 --- .../react/renderer/components/view/ViewShadowNode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp index 641f544bee6..af30883b21f 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp @@ -48,6 +48,7 @@ void ViewShadowNode::initialize() noexcept { }; bool formsStackingContext = !viewProps.collapsable || + viewProps.pointerEvents == PointerEventsMode::BoxOnly || viewProps.pointerEvents == PointerEventsMode::None || !viewProps.nativeId.empty() || viewProps.accessible || viewProps.opacity != 1.0 || viewProps.transform != Transform{} ||