react-image-gallery icon indicating copy to clipboard operation
react-image-gallery copied to clipboard

Vertical thumbnail scrolling broken with react 18 rendering

Open p-young opened this issue 2 years ago • 5 comments

The thumbnail scrolling does not get the proper translate when rendering with react 18.

Using the latest image gallery version (1.2.8) and react (18.1.0).

My guess is that the thumbnailsWrapperHeight is registering as 0 at the start (the translation seems to match that) maybe because of how batch updates or rendering has changed in react 18.

After manually resizing the window and thus resizing react-image-gallery, the resize observers fire and the issue improves. However the calculation is still wrong and it is slightly offset from where the scroll should be.

To reproduce, use the latest react and the new way to start the rendering (createRoot() and root.render() instead of ReactDOM.render()), and set thumbnail position to "left" or "right". Then just change slides around and the issue can be seen.

Changing the render back to ReactDOM.render() (which reverts rendering the same way as React 17) fixes the issue.

A picture attached demonstrates the thumbnail scroll being in the wrong position (and out of bounds)

react-image-gallery-bug

p-young avatar Jun 07 '22 23:06 p-young

Is there anything I can add to help get this looked at? Thanks for the updates!

p-young avatar Aug 01 '22 23:08 p-young

Thanks for reporting, I've not had a chance to test react18's new render. Will look into it when I get a chance.

Fastest way is to open a PR if anyone is down to tackle this issue.

xiaolin avatar Aug 01 '22 23:08 xiaolin

Anyone found a fix for this? Can't figure it out.

alexdevmotion avatar Aug 17 '22 06:08 alexdevmotion

@xiaolin @alexdevmotion I've the same issue, any clue ?

MohammedSaberMohammed avatar Sep 04 '22 21:09 MohammedSaberMohammed

@MohammedSaberMohammed unfortunately not, haven't dug for a workaround yet.

alexdevmotion avatar Sep 12 '22 09:09 alexdevmotion

This should be fixed in v1.2.10

xiaolin avatar Oct 01 '22 22:10 xiaolin

This same issue still exists in React 18.2 and react-image-gallery version 1.30 Thank you in advance.

pickyourdestiny avatar Oct 21 '23 19:10 pickyourdestiny

This same issue still exists in React 18.2 and react-image-gallery version 1.30 Thank you in advance.

yess same with me, issue still exists

FridoAnggoro123 avatar Nov 22 '23 09:11 FridoAnggoro123

any update or fix for this?

subhanyousaf avatar Jan 16 '24 15:01 subhanyousaf