From 77cfa255274fdcdf822e836c7ea98e769bcb865d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 6 Oct 2021 15:27:31 +0200 Subject: mobile --- src/views/Gallery.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/views/Gallery.js') diff --git a/src/views/Gallery.js b/src/views/Gallery.js index e2652df..7681e3b 100644 --- a/src/views/Gallery.js +++ b/src/views/Gallery.js @@ -5,7 +5,7 @@ import React, { useState, useEffect } from "react"; import { mod } from "../utils/index.js"; -export default function Gallery({ images, visible }) { +export default function Gallery({ images, visible, onLoad }) { const hasItems = !!images?.length; const oneItem = images?.length === 1; @@ -15,26 +15,31 @@ export default function Gallery({ images, visible }) { setIndex(0); setOpacity(0); setTimeout(() => setOpacity(1), 500); + onLoad(); }, [images]); function previous() { setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index - 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function next() { setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index + 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function nextOrWrap() { if (oneItem) return; setOpacity(0); + onLoad(); setTimeout(() => setIndex(mod(index + 1, images.length)), 200); // setTimeout(() => setOpacity(1), 500); } function appear() { setOpacity(1); + onLoad(); } if (!hasItems) { @@ -53,7 +58,7 @@ export default function Gallery({ images, visible }) { /> )} -
+
{!oneItem && (