Skip to content

Commit 58ef9e9

Browse files
Alex Danofffacebook-github-bot
authored andcommitted
W3CPointerEvents: add missing attributes to pointer events (#37537)
Summary: Pull Request resolved: #37537 Changelog: [Internal] [Changed] - W3CPointerEvents: add missing attributes to pointer events The [PointerEvent interface](https://www.w3.org/TR/pointerevents/#pointerevent-interface) includes some additional properties which we weren't including in the events we dispatched. This diff adds them (set to default values): - twist - tangentialPressure In the future, we can try to set reasonable values for these properties based on the underlying native events. Reviewed By: NickGerleman Differential Revision: D45747033 fbshipit-source-id: 529f9d90299f33bc04eae3fb85ddd7eac3d61c5b
1 parent 20808b5 commit 58ef9e9

File tree

1 file changed

+3
-0
lines changed
  • packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ private WritableMap createW3CPointerEvent(int index) {
222222
pointerEvent.putDouble("tiltX", 0);
223223
pointerEvent.putDouble("tiltY", 0);
224224

225+
pointerEvent.putInt("twist", 0);
226+
225227
if (pointerType.equals(PointerEventHelper.POINTER_TYPE_MOUSE)) {
226228
pointerEvent.putDouble("width", 1);
227229
pointerEvent.putDouble("height", 1);
@@ -241,6 +243,7 @@ private WritableMap createW3CPointerEvent(int index) {
241243

242244
pointerEvent.putDouble(
243245
"pressure", PointerEventHelper.getPressure(pointerEvent.getInt("buttons"), mEventName));
246+
pointerEvent.putDouble("tangentialPressure", 0.0);
244247

245248
return pointerEvent;
246249
}

0 commit comments

Comments
 (0)