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
This commit is contained in:
David Vacca
2020-03-01 14:11:56 -08:00
committed by Facebook Github Bot
parent 490e33dd88
commit bf0019e433
@@ -6,6 +6,7 @@
*/
#include "ViewShadowNode.h"
#include <react/components/view/primitives.h>
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 &&