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

Fix auto play direction in 2 slides

Open linbudu599 opened this issue 1 year ago • 0 comments

This pr has fixed(not sure if it's a fix) the swipe direction when there're 2 slides with infinite enabled.

Before this PR, if there're 2 slides only, with infinite & autoPlay enabled, when playing from last slide to the first slide, the direction would be from RIGHT to LEFT:

2024-02-01 20 58 10

This seems to be correct, but remember when we made slide imperatively from navigation, it works as 'infinite' indeed: the new slide always comes from the right side:

2024-02-01 21 00 39

I think the swipe direction(or behaviour) should be same exactly whatever it's from auto play or user gesture? And this PR changes the behaviour in previous case to make it always works like 'infinite':

2024-02-01 21 03 47

This PR doesnot make great changes, in opposite, I'm just putting the slideToIndexWithStyleReset into the slideToIndex handler, as all the slide changes goes through here.

linbudu599 avatar Feb 01 '24 13:02 linbudu599