You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Web] Report the hovering pointer's type in Hover gesture events - #4631
On web, HoverGestureHandler reported pointer type mouse for a stylus. The base handler stores the pointer type only in onPointerDown, and a hover never sees a pointerdown, so the default stayed. The value also never resets, so after a pen or finger touched the view, every later hover reported that type instead.
Test plan
Hover a pen over a useHoverGesture view in Chrome: onBegin, onActivate and onUpdate report pointerType: STYLUS with stylus data, a mouse reports MOUSE. Checked on a Galaxy S24 with S Pen and on desktop Chrome with CDP pen events.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
Hover gestures now track the pointer type during pointer-over and pointer-move events.
The web gesture handler adds a protected setter for pointerType. The hover handler uses it to store pointer types from pointer-over and pointer-move events.
Changes: Hover pointer type tracking
Layer / File(s)
Summary
Store pointer types from hover events packages/react-native-gesture-handler/src/web/handlers/GestureHandler.ts, packages/react-native-gesture-handler/src/web/handlers/HoverGestureHandler.ts
GestureHandler adds a protected setter that stores the supplied pointer type. The hover handler assigns the event’s pointer type on pointer-over and pointer-move events.
Suggested reviewers:j-piasecki
Priority: ➖ Normal
Merge Risk:⚪ Minimal · up to 83bf3
The reported hover pointer-type behavior is addressed, with no remaining actionable merge risk identified.
Pre-merge checks: 3
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: reporting the hovering pointer type in web hover gesture events.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On web,
HoverGestureHandlerreported pointer type mouse for a stylus. The base handler stores the pointer type only inonPointerDown, and a hover never sees apointerdown, so the default stayed. The value also never resets, so after a pen or finger touched the view, every later hover reported that type instead.Test plan
Hover a pen over a
useHoverGestureview in Chrome:onBegin,onActivateandonUpdatereportpointerType: STYLUSwith stylus data, a mouse reportsMOUSE. Checked on a Galaxy S24 with S Pen and on desktop Chrome with CDP pen events.