about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-07-03 18:36:49 -0500
committerGitHub <noreply@github.com>2023-07-03 18:36:49 -0500
commitc8eeb6ba1cd74abafc2475a1aaa097a51092fb82 (patch)
treee6433f34d650b51f4e123f568f5a5ad64a4db872 /src
parent40a872612f6429fad90167ff0236df2a66fb6fd0 (diff)
downloadvoidsky-c8eeb6ba1cd74abafc2475a1aaa097a51092fb82.tar.zst
Fix: re-add the scroll boundary to avoid minimal shell at top of screen (#956)
Diffstat (limited to 'src')
-rw-r--r--src/lib/hooks/useOnMainScroll.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/hooks/useOnMainScroll.ts b/src/lib/hooks/useOnMainScroll.ts
index c47da7542..507a28cee 100644
--- a/src/lib/hooks/useOnMainScroll.ts
+++ b/src/lib/hooks/useOnMainScroll.ts
@@ -6,6 +6,7 @@ import {isDesktopWeb} from 'platform/detection'
 
 const DY_LIMIT_UP = isDesktopWeb ? 30 : 10
 const DY_LIMIT_DOWN = isDesktopWeb ? 150 : 10
+const Y_LIMIT = 10
 
 export type OnScrollCb = (
   event: NativeSyntheticEvent<NativeScrollEvent>,
@@ -24,9 +25,16 @@ export function useOnMainScroll(
         const dy = y - (lastY.current || 0)
         lastY.current = y
 
-        if (!store.shell.minimalShellMode && dy > DY_LIMIT_DOWN) {
+        if (
+          !store.shell.minimalShellMode &&
+          dy > DY_LIMIT_DOWN &&
+          y > Y_LIMIT
+        ) {
           store.shell.setMinimalShellMode(true)
-        } else if (store.shell.minimalShellMode && dy < DY_LIMIT_UP * -1) {
+        } else if (
+          store.shell.minimalShellMode &&
+          (dy < DY_LIMIT_UP * -1 || y <= Y_LIMIT)
+        ) {
           store.shell.setMinimalShellMode(false)
         }