mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-19 20:20:18 +02:00
improve horizontal swipe gesture thresholds
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user