Description
The hover gesture reports the wrong type of pointer.
The eventExtraData method of the hover handler uses UITouchTypePencil instead of the RNGH internal RNGestureHandlerStylus, which causes the enum mapping to become MOUSE instead.
https://github.com/software-mansion/react-native-gesture-handler/blob/v2.30.0/packages/react-native-gesture-handler/apple/Handlers/RNHoverHandler.m#L160
The same method also causes the pointer type to be reported as the same, whether using a stylus or a mouse. There doesn't seem to be a clear way of separating the types on iOS, but checking if zOffset property of UIHoverGestureRecognizer is > 0 might suffice?
https://developer.apple.com/documentation/uikit/uihovergesturerecognizer/4098402-zoffset?language=objc
Steps to reproduce
- Open Snack reproducer on an iOS device capable of stylus hover.
- Hover salmon coloured square with Stylus (e.g. Apple Pencil Pro).
- Tap the same area with the same Stylus.
- Notice Tap Pointer Type label indicates STYLUS, while Hover Pointer Type indicates MOUSE.
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
https://snack.expo.dev/@andreashogstromnavigraph/rngh-hover-pointertype
Gesture Handler version
2.29.0
React Native version
0.83.0
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
New Architecture (Fabric)
Build type
None
Device
Real device
Device model
iPad Pro 13-inch (M4)
Acknowledgements
Yes
Description
The hover gesture reports the wrong type of pointer.
The eventExtraData method of the hover handler uses
UITouchTypePencilinstead of the RNGH internalRNGestureHandlerStylus, which causes the enum mapping to become MOUSE instead.https://github.com/software-mansion/react-native-gesture-handler/blob/v2.30.0/packages/react-native-gesture-handler/apple/Handlers/RNHoverHandler.m#L160
The same method also causes the pointer type to be reported as the same, whether using a stylus or a mouse. There doesn't seem to be a clear way of separating the types on iOS, but checking if
zOffsetproperty ofUIHoverGestureRecognizeris> 0might suffice?https://developer.apple.com/documentation/uikit/uihovergesturerecognizer/4098402-zoffset?language=objc
Steps to reproduce
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
https://snack.expo.dev/@andreashogstromnavigraph/rngh-hover-pointertype
Gesture Handler version
2.29.0
React Native version
0.83.0
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
New Architecture (Fabric)
Build type
None
Device
Real device
Device model
iPad Pro 13-inch (M4)
Acknowledgements
Yes