improve horizontal swipe gesture thresholds

This commit is contained in:
Boof2015
2026-07-07 15:28:42 -04:00
parent 675b072f41
commit d05e45e7d3
+5 -2
View File
@@ -22,6 +22,9 @@ import { commitHaptic, tickHaptic } from '@/lib/haptics';
type IconName = keyof typeof Ionicons.glyphMap; type IconName = keyof typeof Ionicons.glyphMap;
const SWIPE_ACTIVE_OFFSET_X = 10;
const SWIPE_FAIL_OFFSET_Y = 30;
export interface SwipeAction { export interface SwipeAction {
icon: IconName; icon: IconName;
/** Background of the revealed action lane. */ /** Background of the revealed action lane. */
@@ -79,8 +82,8 @@ export function SwipeableRow({
const pan = Gesture.Pan() const pan = Gesture.Pan()
.enabled(enabled && rowWidth > 0 && (hasRight || hasLeft)) .enabled(enabled && rowWidth > 0 && (hasRight || hasLeft))
.activeOffsetX([-12, 12]) .activeOffsetX([-SWIPE_ACTIVE_OFFSET_X, SWIPE_ACTIVE_OFFSET_X])
.failOffsetY([-12, 12]) .failOffsetY([-SWIPE_FAIL_OFFSET_Y, SWIPE_FAIL_OFFSET_Y])
.onUpdate((e) => { .onUpdate((e) => {
let t = e.translationX; let t = e.translationX;
if (t > 0 && !hasRight) t = 0; if (t > 0 && !hasRight) t = 0;