about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2022-09-09 11:55:53 -0500
committerPaul Frazee <pfrazee@gmail.com>2022-09-09 11:55:53 -0500
commite6ebb213ccaebb6d0bb37c3141c15f00935e292d (patch)
treea770a4d11a4e1bf67a1e184bbc835ad25fc003e8
parent46d20cdde82d0e1ab42e48baf3d4229b2922d4b7 (diff)
downloadvoidsky-e6ebb213ccaebb6d0bb37c3141c15f00935e292d.tar.zst
Make nav swipes easier to trigger
-rw-r--r--src/view/shell/mobile/index.tsx12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx
index a5e7ba701..d3d020e88 100644
--- a/src/view/shell/mobile/index.tsx
+++ b/src/view/shell/mobile/index.tsx
@@ -34,8 +34,8 @@ import {s, colors} from '../../lib/styles'
 import {AVIS} from '../../lib/assets'
 
 const locationIconNeedsNudgeUp = (icon: IconProp) => icon === 'house'
-const SWIPE_GESTURE_HIT_SLOP = {left: 0, top: 0, width: 20, bottom: 0}
-const SWIPE_GESTURE_TRIGGER = 0.5
+const SWIPE_GESTURE_DIST_TRIGGER = 0.5
+const SWIPE_GESTURE_VEL_TRIGGER = 2500
 
 const Location = ({
   icon,
@@ -154,8 +154,11 @@ export const MobileShell: React.FC = observer(() => {
             )
           }
         })
-        .onEnd(_e => {
-          if (swipeGestureInterp.value >= SWIPE_GESTURE_TRIGGER) {
+        .onEnd(e => {
+          if (
+            swipeGestureInterp.value >= SWIPE_GESTURE_DIST_TRIGGER ||
+            e.velocityX > SWIPE_GESTURE_VEL_TRIGGER
+          ) {
             runOnJS(goBack)()
             swipeGestureInterp.value = withTiming(1, {duration: 100}, () => {
               swipeGestureInterp.value = 0
@@ -344,7 +347,6 @@ const styles = StyleSheet.create({
     paddingTop: 9,
     paddingBottom: 9,
     backgroundColor: colors.gray1,
-    // justifyContent: 'center',
   },
   locationIcon: {
     color: colors.gray5,