Skip to content

Commit 3361290

Browse files
genkikondofacebook-github-bot
authored andcommitted
Trigger pointer leave when active controller switched (#36662)
Summary: Pull Request resolved: #36662 For VR, JSPointerDispatcher skips calculating the delta of hit targets (which happens in onMove) on the frame in which the active controller is switched because the motion event is a DOWN event, not a MOVE event in that specific frame. This diff fixes the issue by just calling onMove in addition to onDown for DOWN motion events. Unfortunately we do not have separate pointer IDs for each controller. This won't change the behavior for non-hoverable pointers. For hoverable pointers, it will dispatch an extra pointer_enter if the hit path has changed between the last move event and the down event. Changelog: [Internal][Fixed] - Trigger pointer leave when active controller switched Reviewed By: lunaleaps, javache Differential Revision: D44377324 fbshipit-source-id: 9f668e64f486b9a12ab36563ec2b7cf93f208a54
1 parent 32e836d commit 3361290

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSPointerDispatcher.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ private void onDown(
158158
motionEvent,
159159
enterViewTargets,
160160
eventDispatcher);
161+
} else {
162+
// There are cases when the pointer may have moved in the same frame as the down event.
163+
// Dispatch the move event before the down event.
164+
onMove(activeTargetTag, eventState, motionEvent, eventDispatcher);
161165
}
162166

163167
boolean listeningForDown =

0 commit comments

Comments
 (0)