Early exit during matching in EventAnimationDriverMatchSpec

Summary:
Simple optimization to exit before iterating through the hit path if the event name doesn't match.

Changelog:
[Android][Internal] - Optimization for natively-driven Animated PointerEvents to early exit during matching in EventAnimationDriverMatchSpec. This should have no effect if you are not using PointerEvents

Reviewed By: lunaleaps

Differential Revision: D43400457

fbshipit-source-id: fe8d811d371c78622cd4f3f9cd469cff9ccce585
This commit is contained in:
Genki Kondo 2023-02-21 16:17:30 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 407fb5c238
Коммит bc749a1623
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -124,14 +124,14 @@ public class PointerEvent extends Event<PointerEvent> {
new EventAnimationDriverMatchSpec() {
@Override
public boolean match(int viewTag, String eventName) {
if (!PointerEventHelper.isBubblingEvent(eventName)) {
if (!eventName.equals(mEventName) || !PointerEventHelper.isBubblingEvent(eventName)) {
return false;
}
List<TouchTargetHelper.ViewTarget> viewTargets =
mEventState.getHitPathForActivePointer();
for (TouchTargetHelper.ViewTarget viewTarget : viewTargets) {
if (viewTarget.getViewId() == viewTag && eventName.equals(mEventName)) {
if (viewTarget.getViewId() == viewTag) {
return true;
}
}