MinJieLiu/react-photo-view

Order of photos in preview does not update when order of PhotoViews is changed

Closed this issue · 3 comments

Hi MinJieLiu, love this library, great work!

I am experiencing one issue: I am trying to build a sortable photo gallery, where I have some buttons which can be used to change the order of the photos (e.g. date taken: most recent at top vs oldest at top). However, the order of the photos in the preview does not update after the order of the photos changes.

Please follow the steps to reproduce:

  1. https://codepen.io/jamesl1001/pen/dygEOLz
  2. Click first thumbnail (dog) > preview opens at "1/3" ✅
  3. Click right and left > order of photos is the same as the thumbnails ✅
  4. Click "Sort by value" > now the order of the thumbnails have changed ✅
  5. Click first thumbnail (building) > preview opens at "3/3" ❌
  6. Click right and left > order of photos is not the same as the thumbnails ❌

Is there some way to resolve this, or is this a bug?

This is an issue that you can use Controlled Mode first, which needs to be fixed here

When you say "Controlled Mode", are you referring to manually implementing the <PhotoSlider> component?

Can confirm: Using the <PhotoSlider> component works to resolve this issue. Thanks!