diff --git a/gatsby-browser.tsx b/gatsby-browser.tsx index 5478107..876a6a0 100644 --- a/gatsby-browser.tsx +++ b/gatsby-browser.tsx @@ -37,7 +37,6 @@ export const shouldUpdateScroll = ({ // window.scrollTo(0, 180); // }) // } - console.log('gallery image, skipping') return false; } if (prevRouterProps?.location.pathname === pathname) { diff --git a/src/components/GalleryImage/GalleryImage.js b/src/components/GalleryImage/GalleryImage.js index ab4ee5e..8481f0d 100644 --- a/src/components/GalleryImage/GalleryImage.js +++ b/src/components/GalleryImage/GalleryImage.js @@ -64,12 +64,12 @@ const GalleryImage = ({ data, location: { state } }) => { }, []); useEffect(() => { - requestAnimationFrame(() => { + setTimeout(() => { window.scrollTo({ top: 180, behavior: 'smooth' }); - }); + }, 50); }, [image.base]); const nextIndex = diff --git a/src/components/MasonryGallery.tsx b/src/components/MasonryGallery.tsx index 9da3b5a..5ffa9ff 100644 --- a/src/components/MasonryGallery.tsx +++ b/src/components/MasonryGallery.tsx @@ -138,8 +138,8 @@ const MasonryGallery = ({ const data = dataFn ? dataFn(image) : null; return (