Skip to content

Commit

Permalink
Do not flatten views with PointerEvents props
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mdvacca authored and facebook-github-bot committed Mar 1, 2020
1 parent 490e33d commit bf0019e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ReactCommon/fabric/components/view/ViewShadowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#include "ViewShadowNode.h"
#include <react/components/view/primitives.h>

namespace facebook {
namespace react {
Expand All @@ -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 &&
Expand Down

0 comments on commit bf0019e

Please sign in to comment.