diff --git a/src/components/Container.tsx b/src/components/Container.tsx index c53a61051..660112abb 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -15,7 +15,7 @@ export default function () { let mousedownId = useRef(); let isMounted = useRef(true); - const { width, height, loop, currentIndex, isPaused, keyboardNavigation, preventDefault, storyContainerStyles = {} } = useContext(GlobalContext); + const { width, height, loop, currentIndex, isPaused, keyboardNavigation, preventDefault, storyContainerStyles = {}, onAllStoriesEnd } = useContext(GlobalContext); const { stories } = useContext(StoriesContext); useEffect(() => { @@ -71,6 +71,7 @@ export default function () { } const previous = () => { + console.log(currentIndex); setCurrentIdWrapper(prev => prev > 0 ? prev - 1 : prev) } @@ -91,6 +92,7 @@ export default function () { const updateNextStoryId = () => { setCurrentIdWrapper(prev => { if (prev < stories.length - 1) return prev + 1 + onAllStoriesEnd && onAllStoriesEnd(currentId, stories) return prev }) } @@ -135,8 +137,8 @@ export default function () { getVideoDuration={getVideoDuration} /> {!preventDefault &&
-
-
+
+
}
)