Use dispatch unique for events that can be coalesced

Summary:
Event merging or "coalescing" is done on Java side from Android, but Fabric also includes some Cxx logic to merge those events. Although Android doesn't need this logic in particular, it is important to follow this path to ensure these events (e.g. scroll) are dispatched as "continuous", allowing for correct prioritization in Concurrent Mode.

`dispatchModernV2` selects between `dispatch` and `dispatchUnique` based on the `canBeCoalesced` parameter of the event, which is exactly what we need. The logic is only used in the "new" event dispatcher at the moment, so I wrapped it with feature flag to validate it doesn't cause any regressions.

Changelog:
[Android][Internal] - Try dispatching coalescing events as unique to Fabric

Reviewed By: sammy-SC

Differential Revision: D31272585

fbshipit-source-id: 6b67b61bd13fbff019d9eb8c5172bdd814a7b5b8
This commit is contained in:
Andrei Shikov
2021-09-30 22:26:33 -07:00
committed by Facebook GitHub Bot
parent 8491edec28
commit 086c967286
2 changed files with 9 additions and 1 deletions
@@ -101,4 +101,6 @@ public class ReactFeatureFlags {
public static boolean insertZReorderBarriersOnViewGroupChildren = true;
public static boolean enableScrollViewSnapToAlignmentProp = true;
public static boolean useDispatchUniqueForCoalescableEvents = false;
}