Skip to content

Commit

Permalink
Early exit during matching in EventAnimationDriverMatchSpec
Browse files Browse the repository at this point in the history
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
  • Loading branch information
genkikondo authored and facebook-github-bot committed Feb 22, 2023
1 parent 407fb5c commit bc749a1
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ public Event.EventAnimationDriverMatchSpec getEventAnimationDriverMatchSpec() {
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;
}
}
Expand Down

0 comments on commit bc749a1

Please sign in to comment.