Disable view flattening when the view has event handlers on Android

Summary:
The views with touch event props are currently flattened by Fabric core, as we don't take event listeners into account when calculating whether the view should be flattened. This results in a confusing situation when components with touch event listeners (e.g. `<View onTouchStart={() => {}} /> `) or ones using `PanResponder` are either ignored (iOS) or cause a crash (Android).

This change passes touch event props to C++ layer and uses them to calculate whether the view node should be flattened or not. It also refactors events to be kept as a singular bitset with 32 bit (~`uint32_t`).

Changelog: [Changed][General] Avoid flattening nodes with event props

Reviewed By: sammy-SC

Differential Revision: D34005536

fbshipit-source-id: 96255b389a7bfff4aa208a96fd0c173d9edf1512
This commit is contained in:
Andrei Shikov authored and Facebook GitHub Bot committed 2022-02-10 06:07:39 -08:00
1 parent 9ed2df628d
commit 980c52de41
10 files changed
+352 -43

No files matched your search

@@ -59,9 +59,9 @@ import java.util.Map;
return MapBuilder.builder()
.put("topContentSizeChange", MapBuilder.of(rn, "onContentSizeChange"))
.put("topLayout", MapBuilder.of(rn, "onLayout"))
.put("topPointerEnter", MapBuilder.of(rn, "pointerenter"))
.put("topPointerLeave", MapBuilder.of(rn, "pointerleave"))
.put("topPointerMove", MapBuilder.of(rn, "pointermove"))
.put("topPointerEnter", MapBuilder.of(rn, "onPointerEnter"))
.put("topPointerLeave", MapBuilder.of(rn, "onPointerLeave"))
.put("topPointerMove", MapBuilder.of(rn, "onPointerMove"))
.put("topLoadingError", MapBuilder.of(rn, "onLoadingError"))
.put("topLoadingFinish", MapBuilder.of(rn, "onLoadingFinish"))
.put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart"))