Fixes bug with gallery not closing

This commit is contained in:
psychedelicious 2022-10-28 21:01:23 +11:00
parent 2c9747fd41
commit 765092eb12
2 changed files with 3 additions and 5 deletions

View File

@ -123,10 +123,8 @@ export default function ImageGallery() {
galleryContainerRef.current ? galleryContainerRef.current.scrollTop : 0 galleryContainerRef.current ? galleryContainerRef.current.scrollTop : 0
) )
); );
if (!shouldHoldGalleryOpen) {
dispatch(setShouldHoldGalleryOpen(false));
}
dispatch(setShouldShowGallery(false)); dispatch(setShouldShowGallery(false));
dispatch(setShouldHoldGalleryOpen(false));
}; };
const handleClickLoadMore = () => { const handleClickLoadMore = () => {
@ -254,7 +252,7 @@ export default function ImageGallery() {
return ( return (
<CSSTransition <CSSTransition
nodeRef={galleryRef} nodeRef={galleryRef}
in={shouldShowGallery || shouldHoldGalleryOpen} in={shouldShowGallery || (shouldHoldGalleryOpen && !shouldPinGallery)}
unmountOnExit unmountOnExit
timeout={200} timeout={200}
classNames="image-gallery-area" classNames="image-gallery-area"

View File

@ -30,7 +30,7 @@ const initialState: GalleryState = {
shouldShowGallery: true, shouldShowGallery: true,
galleryScrollPosition: 0, galleryScrollPosition: 0,
galleryImageMinimumWidth: 64, galleryImageMinimumWidth: 64,
galleryImageObjectFit: 'contain', galleryImageObjectFit: 'cover',
shouldHoldGalleryOpen: false, shouldHoldGalleryOpen: false,
shouldAutoSwitchToNewImages: true, shouldAutoSwitchToNewImages: true,
}; };