react-chrono icon indicating copy to clipboard operation
react-chrono copied to clipboard

Be able to modify autoscroll behaviour when item added

Open Migarl opened this issue 2 years ago • 0 comments

Hey there!

Current behaviour I add new items to the timeline (vertical mode) dynamically, so I set allowDynamicUpdate to true. Each time my state changes (a new item was added) the timeline automatically scrolls to the last item (the very bottom).

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

The problem is that this behavior cannot be changed (or did I missed something?)

Describe the solution you'd like A clear and concise description of what you want to happen.

I want to be able to change this behavior, because in my case new items will be added to the top and it is confusing when the timeline scrolls down to the oldest item.

So a solution to set scroll direction on updated items would be nice. Maybe something like top, bottom, none? none means the timeline shouldn't scroll when a new item added.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. I tried to set activeItemIndex to 0 when a new item was added, nevertheless the timeline is scrolling to the bottom.

So an alternative could be to prioritize activeItemIndex to always scroll to selected item.

Additional context Add any other context or screenshots about the feature request here.

I modified vertical basic example to add a new item after three seconds for better understanding (https://github.com/Migarl/react-chrono)

Hope you understand my request.

Thank you for your great work!

Migarl avatar Feb 19 '22 01:02 Migarl