mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
fix: disable Telegram vertical swipes during drag operations
- Add useTelegramDnd hook for @dnd-kit integration - Update Sheet components to disable swipes when open - Update AdminPaymentMethods to use the new hook - Prevents conflict between app drag gestures and Telegram swipe-to-close
This commit is contained in:
@@ -7,10 +7,12 @@ import {
|
||||
useContext,
|
||||
useState,
|
||||
useCallback,
|
||||
useEffect,
|
||||
} from 'react';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { usePlatform } from '@/platform';
|
||||
import { useBackButton } from '@/platform';
|
||||
import { useTelegramSDK } from '@/hooks/useTelegramSDK';
|
||||
import {
|
||||
backdrop,
|
||||
backdropTransition,
|
||||
@@ -138,10 +140,26 @@ export const SheetContent = forwardRef<HTMLDivElement, SheetContentProps>(
|
||||
const { open, onClose } = useContext(SheetContext);
|
||||
const { haptic } = usePlatform();
|
||||
const dragControls = useDragControls();
|
||||
const { disableVerticalSwipes, enableVerticalSwipes, isTelegramWebApp } = useTelegramSDK();
|
||||
|
||||
// Back button integration
|
||||
useBackButton(open ? onClose : null);
|
||||
|
||||
// Disable Telegram vertical swipes when sheet is open (prevents conflict with drag gestures)
|
||||
useEffect(() => {
|
||||
if (!isTelegramWebApp) return;
|
||||
|
||||
if (open) {
|
||||
disableVerticalSwipes();
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (open) {
|
||||
enableVerticalSwipes();
|
||||
}
|
||||
};
|
||||
}, [open, isTelegramWebApp, disableVerticalSwipes, enableVerticalSwipes]);
|
||||
|
||||
const handleDragEnd = useCallback(
|
||||
(_: MouseEvent | TouchEvent | PointerEvent, info: PanInfo) => {
|
||||
const velocity = info.velocity.y;
|
||||
|
||||
Reference in New Issue
Block a user