diff --git a/components/carousel.js b/components/carousel.js
index 5be0216a..3d69152e 100644
--- a/components/carousel.js
+++ b/components/carousel.js
@@ -53,12 +53,19 @@ function useArrowKeys ({ moveLeft, moveRight }) {
}, [onKeyDown])
}
-function Carousel ({ close, mediaArr, src }) {
+function Carousel ({ close, mediaArr, src, setOptions }) {
const [index, setIndex] = useState(mediaArr.findIndex(([key]) => key === src))
const [currentSrc, canGoLeft, canGoRight] = useMemo(() => {
return [mediaArr[index][0], index > 0, index < mediaArr.length - 1]
}, [mediaArr, index])
+ useEffect(() => {
+ if (index === -1) return
+ setOptions({
+ overflow:
+ })
+ }, [index, mediaArr, setOptions])
+
const moveLeft = useCallback(() => {
setIndex(i => Math.max(0, i - 1))
}, [setIndex])
@@ -108,8 +115,8 @@ export function CarouselProvider ({ children }) {
const showModal = useShowModal()
const showCarousel = useCallback(({ src }) => {
- showModal((close) => {
- return
+ showModal((close, setOptions) => {
+ return
}, {
fullScreen: true,
overflow: