Skip to content

Commit 3bd1925

Browse files
mscststscrazylxr
andauthored
fix: 解决桌面端 Safari 不兼容 TouchEvent 的问题 (#2602)
Co-authored-by: lxr <[email protected]>
1 parent 2bc738f commit 3bd1925

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/hooks/src/useLongPress/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function useLongPress(
5454
};
5555

5656
function getClientPosition(event: EventType) {
57-
if (event instanceof TouchEvent) {
57+
if ('TouchEvent' in window && event instanceof TouchEvent) {
5858
return {
5959
clientX: event.touches[0].clientX,
6060
clientY: event.touches[0].clientY,

0 commit comments

Comments
 (0)