You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes it would be nice if the activeItemIndex would not only select the active timeline item only on load but could also be controlled (like in a controlled component) later. For instance for using custom prev / next buttons to jump to a certain timeline item. Or setting the active item by some other kind of app state.
Describe the solution you'd like
Since activeItemIndex is unready set to be only used "on load", maybe add another prop like controlledActiveItemIndex. In the end - looking at the code for
-- it just seems to be a matter of calling handleTimelineUpdate(newTimeLineItem) and setActiveTimelineItem(newTimeLineItem)
Describe alternatives you've considered
I looked into a way how maybe handleTimelineUpdate(newTimeLineItem) and setActiveTimelineItem(newTimeLineItem) could be called from outside, but did not find a way. Both functions do not seem to be exposed. Actually, just exposing handleTimelineUpdate(newTimeLineItem) would probably be sufficient as it internally calls setActiveTimelineItem(newTimeLineItem) itself:
As requested in prabhuignoto#300
(and also because I needed it 😄), this implements a simple `useEffect`
that updates the `activeTimelineIndex` accordingly.
…x (#320)
As requested in prabhuignoto/react-chrono#300
(and also because I needed it 😄), this implements a simple `useEffect`
that updates the `activeTimelineIndex` accordingly.
Is your feature request related to a problem? Please describe.
Sometimes it would be nice if the
activeItemIndex
would not only select the active timeline item only on load but could also be controlled (like in a controlled component) later. For instance for using custom prev / next buttons to jump to a certain timeline item. Or setting the active item by some other kind of app state.Describe the solution you'd like
Since
activeItemIndex
is unready set to be only used "on load", maybe add another prop likecontrolledActiveItemIndex
. In the end - looking at the code forreact-chrono/src/components/index.tsx
Lines 119 to 126 in 750a314
handleTimelineUpdate(newTimeLineItem)
andsetActiveTimelineItem(newTimeLineItem)
Describe alternatives you've considered
I looked into a way how maybe
handleTimelineUpdate(newTimeLineItem)
andsetActiveTimelineItem(newTimeLineItem)
could be called from outside, but did not find a way. Both functions do not seem to be exposed. Actually, just exposinghandleTimelineUpdate(newTimeLineItem)
would probably be sufficient as it internally callssetActiveTimelineItem(newTimeLineItem)
itself:react-chrono/src/components/index.tsx
Lines 84 to 99 in 750a314
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: