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
I believe that W3C Pointer Events would be a perfect fit for inclusion in React Native in the future.
This discussion could serve as brainstorming for what various APIs/restrictions could be in place if these were implemented, or if this should be done at all.
The Core of It
They enable handling these kinds of inputs from the same event:
touch - Already supported by current (and upcoming) RN APIs, but allows for code that handles all 3 types.
mouse - Useful for desktop platforms, Android, and RNDom/RNWeb. Includes info on which button was pressed.
pen - Could handle the Apple Pencil on iOS, Galaxy Note stylus (and others) on Android, Wacom, Surface Pen (and others) on desktop platforms. Includes pressure and tilt info.
The additional event props added would be:
onPointerOver
onPointerEnter
onPointerDown
onPointerMove
onPointerUp
onPointerCancel
onPointerOut
onPointerLeave
onGotPointerCapture
onLostPointerCapture
Of the bits of Fabric that are currently open sourced, there's a great W3C touch events implementation in the works:
I suspect that a lot of this could be built on top of the work done on that. When Fabric is released, it'll be easier to reason about this.
Discussion points
Should there be new components for pointer events in the vein of <TouchableWithFeedback />, like: <PointerPressWithFeedback />, <PointerOverWithFeedback />, etc?
Being able to handle touch events in the Touch Events implementation and in Pointer Events might be seen as redundant. Is this an issue? If so, is there a better way to support desktop events in core react native? (Level 2 of Touch events will support Styluses too, so an additional area where it could be redundant)
This discussion was converted from issue #51 on June 08, 2021 15:20.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Introduction
I believe that W3C Pointer Events would be a perfect fit for inclusion in React Native in the future.
This discussion could serve as brainstorming for what various APIs/restrictions could be in place if these were implemented, or if this should be done at all.
The Core of It
They enable handling these kinds of inputs from the same event:
touch
- Already supported by current (and upcoming) RN APIs, but allows for code that handles all 3 types.mouse
- Useful for desktop platforms, Android, and RNDom/RNWeb. Includes info on which button was pressed.pen
- Could handle the Apple Pencil on iOS, Galaxy Note stylus (and others) on Android, Wacom, Surface Pen (and others) on desktop platforms. Includes pressure and tilt info.The additional event props added would be:
onPointerOver
onPointerEnter
onPointerDown
onPointerMove
onPointerUp
onPointerCancel
onPointerOut
onPointerLeave
onGotPointerCapture
onLostPointerCapture
Of the bits of Fabric that are currently open sourced, there's a great W3C touch events implementation in the works:
https://github.com/facebook/react-native/blob/188cbb04ad264aea32ae235b85b61e626b767b83/ReactCommon/fabric/components/view/TouchEventEmitter.cpp
I suspect that a lot of this could be built on top of the work done on that. When Fabric is released, it'll be easier to reason about this.
Discussion points
<TouchableWithFeedback />
, like:<PointerPressWithFeedback />
,<PointerOverWithFeedback />
, etc?Beta Was this translation helpful? Give feedback.
All reactions