From 5ecba144f0ca0e3cd3a93ded0397c02d1dab63f7 Mon Sep 17 00:00:00 2001 From: thislight Date: Thu, 21 Nov 2024 17:23:40 +0800 Subject: [PATCH] StackedRouter: fix default prevention not work --- src/platform/StackedRouter.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/platform/StackedRouter.tsx b/src/platform/StackedRouter.tsx index 4eb58bb..887a8a5 100644 --- a/src/platform/StackedRouter.tsx +++ b/src/platform/StackedRouter.tsx @@ -316,12 +316,11 @@ const StackedRouter: Component = (oprops) => { origFigX = fig0.clientX; origFigY = fig0.clientY; - if ( - fig0.clientX < -22 || - fig0.clientX > 22 || - fig0.clientX < window.innerWidth - 22 || - fig0.clientX > window.innerWidth + 22 - ) { + const isNotInSwipeToBackArea = + (fig0.clientX > 22 && fig0.clientX < window.innerWidth - 22) || + (fig0.clientX < -22 && fig0.clientX > window.innerWidth + 22); + + if (isNotInSwipeToBackArea) { return; } // Prevent the default swipe to back/forward on iOS