Skip to content

Commit

Permalink
fix(image-lightbox): fix reset zoom scale when switching to the first…
Browse files Browse the repository at this point in the history
… item
  • Loading branch information
gcornut committed Sep 6, 2024
1 parent 66d1323 commit d10a1d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- `useImageLightbox`: update props each time the lightbox opens.
- `ImageLightbox`: fix reset zoom scale when switching to the first item.

## [3.9.0][] - 2024-09-03

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const ImageSlideshow: React.FC<ImageSlideshowProps> = ({
const zoomOut = React.useCallback(() => onScaleChange?.(0.5), [onScaleChange]);
React.useEffect(() => {
// Reset scale on slide change
if (activeIndex) setScale(undefined);
if (typeof activeIndex === 'number') setScale(undefined);
}, [activeIndex]);
const zoomControls = zoomEnabled && (
<>
Expand Down

0 comments on commit d10a1d8

Please sign in to comment.