Skip to content

Commit

Permalink
fix: 解决桌面端 Safari 不兼容 TouchEvent 的问题 (#2602)
Browse files Browse the repository at this point in the history
Co-authored-by: lxr <[email protected]>
  • Loading branch information
mscststs and crazylxr authored Jul 18, 2024
1 parent 2bc738f commit 3bd1925
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/hooks/src/useLongPress/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function useLongPress(
};

function getClientPosition(event: EventType) {
if (event instanceof TouchEvent) {
if ('TouchEvent' in window && event instanceof TouchEvent) {
return {
clientX: event.touches[0].clientX,
clientY: event.touches[0].clientY,
Expand Down

0 comments on commit 3bd1925

Please sign in to comment.