From ffe49ff90fd35e457f398c12aa40d25672694f3e Mon Sep 17 00:00:00 2001 From: p-sw Date: Wed, 5 Jun 2024 19:16:42 +0900 Subject: [PATCH] fix: ensure delta value is absolute in Drawer component The fix ensures that the calculation of the 'movement' value in the Drawer component doesn't result in a negative number. The division by 'dragState.delta' is now divided by the absolute value to prevent faulty calculations. --- packages/react/components/Drawer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/components/Drawer.tsx b/packages/react/components/Drawer.tsx index efb4719..cec3237 100644 --- a/packages/react/components/Drawer.tsx +++ b/packages/react/components/Drawer.tsx @@ -261,7 +261,7 @@ const DrawerContent = forwardRef( movement < 0) ) { movement = - movement / (dragState.delta === 0 ? 1 : dragState.delta); + movement / Math.abs(dragState.delta === 0 ? 1 : dragState.delta); } return { ...prev,