From 3bd192572fc65c98eb5701453e5ea09644b669f1 Mon Sep 17 00:00:00 2001 From: mscststs Date: Thu, 18 Jul 2024 09:10:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E7=AB=AF=20Safari=20=E4=B8=8D=E5=85=BC=E5=AE=B9=20TouchEvent?= =?UTF-8?q?=20=E7=9A=84=E9=97=AE=E9=A2=98=20(#2602)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: lxr <1076629390@qq.com> --- packages/hooks/src/useLongPress/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/hooks/src/useLongPress/index.ts b/packages/hooks/src/useLongPress/index.ts index a676bcef90..caa3aee13a 100644 --- a/packages/hooks/src/useLongPress/index.ts +++ b/packages/hooks/src/useLongPress/index.ts @@ -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,