Skip to content

Commit

Permalink
change invalid activeIndex when the number of items in the gallery is…
Browse files Browse the repository at this point in the history
… smaller than the current activeIndex (#1259)
  • Loading branch information
Galpittel authored Jul 11, 2024
1 parent a217b15 commit 900e047
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,18 @@ class SlideshowView extends React.Component {
this.startAutoSlideshowIfNeeded(props.options);
});
}
if (this.state.activeIndex > props.items.length - 1) {
utils.setStateAndLog(
this,
'Next Item',
{
activeIndex: 0,
},
() => {
this.onCurrentItemChanged();
}
);
}
if (this.props.activeIndex !== props.activeIndex) {
utils.setStateAndLog(
this,
Expand Down

0 comments on commit 900e047

Please sign in to comment.