From 047665c07a845b71d34ef12df2866a2ccd5e6419 Mon Sep 17 00:00:00 2001 From: kazachilo Date: Wed, 26 Mar 2025 10:15:16 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BE=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D1=82=D0=BD=D0=BE=D0=B5=20=D0=BC=D0=B5=D0=BD=D1=8E=20?= =?UTF-8?q?=D0=BD=D0=B0=20Android=20=D0=B8=20=D1=83=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D1=88=D0=B5=D0=BD=D0=B0=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0?= =?UTF-8?q?=20=D1=81=20=D0=B8=D0=B7=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/shared/ImageWithFallback.module.css | 6 ++++++ src/components/shared/ImageWithFallback.tsx | 11 ++++++++++- src/components/shared/NotificationModal.tsx | 6 ++++-- src/screens/Gallery.tsx | 2 ++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/shared/ImageWithFallback.module.css b/src/components/shared/ImageWithFallback.module.css index ccae8b8..8e9d5c0 100644 --- a/src/components/shared/ImageWithFallback.module.css +++ b/src/components/shared/ImageWithFallback.module.css @@ -7,6 +7,10 @@ display: flex; justify-content: center; align-items: center; + touch-action: none; + -webkit-touch-callout: none; + -webkit-user-select: none; + user-select: none; } .image { @@ -14,6 +18,8 @@ height: 100%; object-fit: cover; transition: opacity 0.3s ease; + pointer-events: none; + touch-action: none; } .hidden { diff --git a/src/components/shared/ImageWithFallback.tsx b/src/components/shared/ImageWithFallback.tsx index 6ec746b..dc8fc2b 100644 --- a/src/components/shared/ImageWithFallback.tsx +++ b/src/components/shared/ImageWithFallback.tsx @@ -8,6 +8,7 @@ interface ImageWithFallbackProps { onClick?: () => void; onContextMenu?: (e: React.MouseEvent) => void; maxRetries?: number; + isDeleteMode?: boolean; } const ImageWithFallback: React.FC = ({ @@ -16,7 +17,8 @@ const ImageWithFallback: React.FC = ({ className = '', onClick, onContextMenu, - maxRetries = 2 // По умолчанию 2 попытки автоматической перезагрузки + maxRetries = 2, // По умолчанию 2 попытки автоматической перезагрузки + isDeleteMode = false }) => { const [loading, setLoading] = useState(true); const [error, setError] = useState(false); @@ -112,6 +114,12 @@ const ImageWithFallback: React.FC = ({ className={`${styles.container} ${className}`} onClick={handleClick} onContextMenu={onContextMenu} + onTouchStart={(e) => { + // Предотвращаем стандартное поведение только если не в режиме удаления + if (!isDeleteMode && onContextMenu) { + e.preventDefault(); + } + }} > {/* Показываем индикатор загрузки, если изображение загружается */} {loading && ( @@ -125,6 +133,7 @@ const ImageWithFallback: React.FC = ({ ref={imgRef} src={imageSrc} alt={alt} + draggable="false" className={`${styles.image} ${error ? styles.hidden : ''}`} onLoad={handleLoad} onError={handleError} diff --git a/src/components/shared/NotificationModal.tsx b/src/components/shared/NotificationModal.tsx index 1923d1e..cda775c 100644 --- a/src/components/shared/NotificationModal.tsx +++ b/src/components/shared/NotificationModal.tsx @@ -12,6 +12,7 @@ interface NotificationModalProps { showGalleryButton?: boolean; // Параметр для управления видимостью кнопки "В галерею" showButtons?: boolean; // Новый параметр для управления видимостью всех кнопок continueButtonText?: string; // Новый параметр для изменения текста кнопки "Продолжить" + galleryButtonText?: string; // Новый параметр для изменения текста кнопки "В галерею" } const NotificationModal: React.FC = ({ @@ -24,7 +25,8 @@ const NotificationModal: React.FC = ({ onContinueClick, showGalleryButton = true, // По умолчанию кнопка "В галерею" видима showButtons = true, // По умолчанию все кнопки видимы - continueButtonText = 'Продолжить' // По умолчанию текст кнопки "Продолжить" + continueButtonText = 'Продолжить', // По умолчанию текст кнопки "Продолжить" + galleryButtonText = 'В галерею' // По умолчанию текст кнопки "В галерею" }) => { if (!isVisible) return null; @@ -53,7 +55,7 @@ const NotificationModal: React.FC = ({ className={`${styles.button} ${styles.secondaryButton}`} onClick={onGalleryClick} > - Отмена + {galleryButtonText} )}