From 97c814aeace119d2e7f530e2cecff0d4f3e9c7de Mon Sep 17 00:00:00 2001 From: daisy <904492381@qq.com> Date: Wed, 12 Jun 2024 11:15:14 +0800 Subject: [PATCH] fix: resolve passive warning --- src/hooks/useTouchMove.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useTouchMove.ts b/src/hooks/useTouchMove.ts index 79169957..49e945b1 100644 --- a/src/hooks/useTouchMove.ts +++ b/src/hooks/useTouchMove.ts @@ -124,11 +124,11 @@ export default function useTouchMove( } document.addEventListener('touchmove', onProxyTouchMove, { passive: false }); - document.addEventListener('touchend', onProxyTouchEnd, { passive: false }); + document.addEventListener('touchend', onProxyTouchEnd, { passive: true }); // No need to clean up since element removed - ref.current.addEventListener('touchstart', onProxyTouchStart, { passive: false }); - ref.current.addEventListener('wheel', onProxyWheel); + ref.current.addEventListener('touchstart', onProxyTouchStart, { passive: true }); + ref.current.addEventListener('wheel', onProxyWheel, { passive: false }); return () => { document.removeEventListener('touchmove', onProxyTouchMove);