Skip to content

Commit

Permalink
Fix: use image length instead of fixed value for imageStageRefs
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-soft committed Aug 27, 2019
1 parent 915b90d commit 2bdc424
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/ImageStage/components/ImagePager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import Image from '../Image';
*/
const ImagePager = ({ images, currentIndex, onPrev, onNext, onClose }) => {
const firstRender = useRef(true);
const imageStageRef = useRef([...Array(3)].map(() => React.createRef()));
const imageStageRef = useRef(
[...Array(images.length)].map(() => React.createRef())
);
const { width: pageWidth } = useWindowSize();
const [disableDrag, setDisableDrag] = useState(false);

Expand Down

0 comments on commit 2bdc424

Please sign in to comment.