From bf0019e4336a0c7392f14c152fd4e756b93dfc27 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Sun, 1 Mar 2020 14:09:21 -0800 Subject: [PATCH] Do not flatten views with PointerEvents props Summary: Some of the values of pointer events should be propagated across the hierarchy of views, e.g. the pointerEvent value NONE: https://reactnative.dev/docs/view#pointerevents That mean that we can't flatten these views (or we should propagate these values across alll the hierarchy of a view that is being flatten) For now I'm going to prevent these views to be flatten, this behavior is consistent with the Adroid view flattening algorithm: https://our.intern.facebook.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java?commit=1144adb5b45bf9a8c8cedf4ac86a2e9ccb429815&lines=249 changelog: [internal] Reviewed By: shergin Differential Revision: D20180804 fbshipit-source-id: 1fe7fc99c873a28c077b3859f8a7884d38b6d4d8 --- ReactCommon/fabric/components/view/ViewShadowNode.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReactCommon/fabric/components/view/ViewShadowNode.cpp b/ReactCommon/fabric/components/view/ViewShadowNode.cpp index e2a165c0529..f0d5fe92160 100644 --- a/ReactCommon/fabric/components/view/ViewShadowNode.cpp +++ b/ReactCommon/fabric/components/view/ViewShadowNode.cpp @@ -6,6 +6,7 @@ */ #include "ViewShadowNode.h" +#include namespace facebook { namespace react { @@ -20,6 +21,8 @@ bool ViewShadowNode::isLayoutOnly() const { viewProps.nativeId.empty() && // Accessibility Props !viewProps.accessible && + // Pointer events Props + (viewProps.pointerEvents == PointerEventsMode::Auto || viewProps.pointerEvents == PointerEventsMode::BoxNone) && // Style Props viewProps.opacity == 1.0 && !viewProps.backgroundColor && !viewProps.foregroundColor && !viewProps.shadowColor &&