Skip to content

Commit

Permalink
Add touchType to touchEvent (#2941)
Browse files Browse the repository at this point in the history
This PR adds pointerType to touchEvent on android and web.
This propet is already present on ios but it's missing from web and
android.
  • Loading branch information
latekvo authored Jun 12, 2024
1 parent d68756f commit 0fbf328
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class RNGestureHandlerTouchEvent private constructor() : Event<RNGestureHandlerT
putInt("state", handler.state)
putInt("numberOfTouches", handler.trackedPointersCount)
putInt("eventType", handler.touchEventType)
putInt("pointerType", handler.pointerType)

handler.consumeChangedTouchesPayload()?.let {
putArray("changedTouches", it)
Expand Down
2 changes: 2 additions & 0 deletions src/web/handlers/GestureHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ export default abstract class GestureHandler implements IGestureHandler {
changedTouches: changed,
allTouches: all,
numberOfTouches: numberOfTouches,
pointerType: this.pointerType,
},
timeStamp: Date.now(),
};
Expand Down Expand Up @@ -556,6 +557,7 @@ export default abstract class GestureHandler implements IGestureHandler {
changedTouches: changed,
allTouches: all,
numberOfTouches: all.length,
pointerType: this.pointerType,
},
timeStamp: Date.now(),
};
Expand Down
1 change: 1 addition & 0 deletions src/web/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ interface NativeTouchEvent extends Record<string, TouchNativeArgs> {
changedTouches: PointerData[];
allTouches: PointerData[];
numberOfTouches: number;
pointerType: PointerType;
}

export interface ResultEvent extends Record<string, NativeEvent | number> {
Expand Down

0 comments on commit 0fbf328

Please sign in to comment.