Skip to content

Commit c601835

Browse files
mdvaccaosdnk
authored andcommitted
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
1 parent 7eb389a commit c601835

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ReactCommon/fabric/components/view/ViewShadowNode.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include "ViewShadowNode.h"
9+
#include <react/components/view/primitives.h>
910

1011
namespace facebook {
1112
namespace react {
@@ -20,6 +21,8 @@ bool ViewShadowNode::isLayoutOnly() const {
2021
viewProps.nativeId.empty() &&
2122
// Accessibility Props
2223
!viewProps.accessible &&
24+
// Pointer events Props
25+
(viewProps.pointerEvents == PointerEventsMode::Auto || viewProps.pointerEvents == PointerEventsMode::BoxNone) &&
2326
// Style Props
2427
viewProps.opacity == 1.0 && !viewProps.backgroundColor &&
2528
!viewProps.foregroundColor && !viewProps.shadowColor &&

0 commit comments

Comments
 (0)