Skip to content

Commit

Permalink
Allow dependent applications to programmatically set the current index
Browse files Browse the repository at this point in the history
As requested in prabhuignoto#300
(and also because I needed it πŸ˜„), this implements a simple `useEffect`
that updates the `activeTimelineIndex` accordingly.
  • Loading branch information
DrakeXorn committed Jan 31, 2023
1 parent f263b60 commit c7dcef0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ const Chrono: React.FunctionComponent<Partial<TimelineProps>> = (
}
}, []);

useEffect(() => {
handleTimelineUpdate(activeItemIndex);
}, [activeItemIndex]);

const restartSlideShow = useCallback(() => {
setSlideshowActive(true);
handleTimelineUpdate(0);
Expand Down

0 comments on commit c7dcef0

Please sign in to comment.