fix: double tap works indipendant of controls showing

This commit is contained in:
Fredrik Burmester
2025-11-17 07:25:20 +01:00
parent cd7a7b0e0e
commit 5358c1e1d5
2 changed files with 22 additions and 25 deletions

View File

@@ -247,9 +247,8 @@ export const GestureOverlay = ({
screenHeight,
});
// If controls are visible, act like the old tap overlay
if (showControls) {
return (
// Background overlay when controls are visible
const controlsOverlay = showControls && (
<Pressable
onPress={onToggleControls}
style={{
@@ -265,11 +264,13 @@ export const GestureOverlay = ({
}}
/>
);
}
return (
<>
{/* Gesture detection area */}
{/* Controls overlay when visible */}
{controlsOverlay}
{/* Gesture detection area - always present */}
<Pressable
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}

View File

@@ -4,8 +4,6 @@ import type { GestureResponderEvent } from "react-native";
export interface SwipeGestureOptions {
minDistance?: number;
maxDuration?: number;
onSwipeLeft?: () => void;
onSwipeRight?: () => void;
onDoubleTapLeft?: () => void;
onDoubleTapRight?: () => void;
onVerticalDragStart?: (side: "left" | "right", initialY: number) => void;
@@ -23,8 +21,6 @@ export interface SwipeGestureOptions {
export const useGestureDetection = ({
minDistance = 50,
maxDuration = 800,
onSwipeLeft,
onSwipeRight,
onDoubleTapLeft,
onDoubleTapRight,
onVerticalDragStart,
@@ -207,7 +203,7 @@ export const useGestureDetection = ({
lastTapTime.current = 0;
lastTapPosition.current = { x: 0, y: 0 };
} else {
// It's a single tap
// It's a single tap - execute immediately
onTap?.();
lastTapTime.current = currentTime;
lastTapPosition.current = { x: tapX, y: tapY };