Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMouseEnter/onMouseLeave for genereric Views πŸ“±πŸ–±οΈ #492

Closed
lgxm3z opened this issue Jul 13, 2022 · 7 comments
Closed

onMouseEnter/onMouseLeave for genereric Views πŸ“±πŸ–±οΈ #492

lgxm3z opened this issue Jul 13, 2022 · 7 comments

Comments

@lgxm3z
Copy link

lgxm3z commented Jul 13, 2022

Introduction

You can connect mouse to mobile devices via USB or Bluetooth but while working with generic view, hover events for that are not exposed.

Example of discord app's usage for hover events:

Reference

Android OnHoverListener:
https://developer.android.com/reference/android/view/View.OnHoverListener

IOS UIHoverGestureRecognizer:
https://developer.apple.com/documentation/uikit/uihovergesturerecognizer

@AlanSl
Copy link

AlanSl commented Jul 28, 2022

+1 and it's not just a mouse this would be useful for:

  • Many Android devices have pens with some form of "air hover" feature, e.g. the Samsung Galaxy s-pen is very widely used, and I believe there are others too (e.g. high-end tablets marketed at digital artists?).
  • I believe the Apple Pencil (and connected mouse) does something similar on iOS? iOS has UIHoverGestureRecognizer like Android's View.OnHoverListener you mentioned in the issue.

I believe these all trigger the same hover events as a connected mouse. Many pure-native apps support hover events perfectly for these.

@lgxm3z
Copy link
Author

lgxm3z commented Jul 28, 2022

+1 and it's not just a mouse this would be useful for:

  • Many Android devices have pens with some form of "air hover" feature, e.g. the Samsung Galaxy s-pen is very widely used, and I believe there are others too (e.g. high-end tablets marketed at digital artists?).
  • I believe the Apple Pencil (and connected mouse) does something similar on iOS? iOS has UIHoverGestureRecognizer like Android's View.OnHoverListener you mentioned in the issue.

I believe these all trigger the same hover events as a connected mouse. Many pure-native apps support hover events perfectly for these.

Excellent point. Thanks for adding to the discussion!

@lgxm3z
Copy link
Author

lgxm3z commented Jul 30, 2022

Looking at the react-native code I found that this kind of pointer event seems to be under development and we will get there soon.

facebook/react-native@6e5cefe

@lgxm3z lgxm3z changed the title onHover for genereric Views πŸ“±πŸ–±οΈ onMouseDown/onMouseUp for genereric Views πŸ“±πŸ–±οΈ Aug 3, 2022
@lgxm3z lgxm3z changed the title onMouseDown/onMouseUp for genereric Views πŸ“±πŸ–±οΈ onMouseEnter/onMouseLeave for genereric Views πŸ“±πŸ–±οΈ Aug 3, 2022
@lgxm3z
Copy link
Author

lgxm3z commented Aug 16, 2022

Btw, seems @lunaleaps is actively working on it...
Thank you a lot ❀️

image

https://github.com/facebook/react-native/commits?author=lunaleaps

@lunaleaps
Copy link

@vincentriemer and I are working on implementing the PointerEvent spec and have some coarse implementation of it. You can opt into it using ReactFeatureFlag dispatchPointerEvents on Android, there's an equivalent flag in iOS.

@lgxm3z
Copy link
Author

lgxm3z commented Dec 22, 2022

https://reactnative.dev/blog/2022/12/13/pointer-events-in-react-native

@lunaleaps
Copy link

lunaleaps commented Dec 23, 2022

@runtothedoor Let us know if you end up trying it and have any thoughts: #557

I'll close this and we can continue discussion there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants