jossmac / jossmac/react-images

onClose, Carousel index jumps back to "currentIndex" defined in prop

Open
#365 4 comments 7 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

**Steps to reproduce the behavior:**
I'm explicitly defining the `currentIndex` based on state so that when an image is clicked it opens at that index. However, if you navigate to other images from the Modal and then close the Modal it "jumps" the index back to the one set from the state when initially opened, causing a brief image swap while the Modal fades out.

**Expected behavior:**
The index of the Carousel to remain the same onClose

**Actual behavior:**
Index "jumps" onClose, showing wrong image during modal closing animation.

![wtf](https://user-images.githubusercontent.com/737188/80248594-3bf18600-863e-11ea-840c-2548394edc68.gif)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.