Skip to content

Images shake when loading #141

Answered by igordanchenko
onmybob asked this question in Q&A
Oct 28, 2023 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

The main issue that I see in your code is that you are not properly sizing your <div> wrappers, which results in layout shift every time an image finishes loading and you end up with dozens of layout shifts before the page finishes loading. I highly recommend you use the following official example as a starting point of your implementation - https://react-photo-album.com/documentation#RenderPhoto_RenderPhotoUsageExample

Also, since you are using Next.js, you can also improve the UX by utilizing Next.js next/image image component (https://react-photo-album.com/examples/nextjs) and implementing placeholder: "blur".

I'm pretty sure your concern will be addressed once you implement the above …

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by igordanchenko
Comment options

You must be logged in to vote
1 reply
@igordanchenko
Comment options

Comment options

You must be logged in to vote
1 reply
@igordanchenko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants