1
0
Fork 0

Revert "Delay onClose after swipe"

This reverts commit 0feee7ea93.
This commit is contained in:
Lim Chee Aun 2022-12-28 20:35:49 +08:00
parent 0feee7ea93
commit e32c6c6473

View file

@ -1272,9 +1272,8 @@ function Carousel({ mediaAttachments, index = 0, onClose = () => {} }) {
const [showControls, setShowControls] = useState(false);
useEffect(() => {
let swipeTimeout;
let handleSwipe = () => {
swipeTimeout = setTimeout(onClose, 500);
onClose();
};
if (carouselRef.current) {
carouselRef.current.addEventListener('swiped-down', handleSwipe);
@ -1283,7 +1282,6 @@ function Carousel({ mediaAttachments, index = 0, onClose = () => {} }) {
if (carouselRef.current) {
carouselRef.current.removeEventListener('swiped-down', handleSwipe);
}
clearTimeout(swipeTimeout);
};
}, []);