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
This commit is contained in:
Fabrizio Cucci authored and meta-codesync[bot] committed 2026-01-16 08:38:46 -08:00
1 parent 03b1bf608d
commit 0649717a3d
1 file changed
+1
@@ -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{} ||