fix: disable Telegram swipe-to-close globally to prevent accidental app closures

This commit is contained in:
c0mrade
2026-02-02 00:55:39 +03:00
parent 09584fc901
commit 9b0be280d2
4 changed files with 14 additions and 72 deletions

View File

@@ -2,7 +2,6 @@ import { useEffect, useRef, useCallback, useState, type ReactNode } from 'react'
import { createPortal } from 'react-dom';
import { useBackButton } from '@/platform';
import { useHaptic } from '@/platform';
import { useTelegramSDK } from '@/hooks/useTelegramSDK';
export interface SheetProps {
isOpen: boolean;
@@ -105,26 +104,10 @@ export function Sheet({
const [isVisible, setIsVisible] = useState(false);
const haptic = useHaptic();
const { disableVerticalSwipes, enableVerticalSwipes, isTelegramWebApp } = useTelegramSDK();
// BackButton integration
useBackButton(isOpen ? onClose : null);
// Disable Telegram vertical swipes when sheet is open (prevents conflict with drag gestures)
useEffect(() => {
if (!isTelegramWebApp) return;
if (isOpen) {
disableVerticalSwipes();
}
return () => {
if (isOpen) {
enableVerticalSwipes();
}
};
}, [isOpen, isTelegramWebApp, disableVerticalSwipes, enableVerticalSwipes]);
// Calculate current height based on snap point
const currentHeight = `${snapPoints[currentSnapIndex] * 100}vh`;