Open atheck opened 2 years ago
@atheck this happens because how the library is implemented it's hard to distinguish between a select and drag an item vs dragging the timeline to scroll. Please feel free to submit a PR with a fix for this issue.
I would like to fix this issue, but I am just starting with open source. Can someone please guide on this ?
Hey I want to contribute to this issue can you please assign this task to me
i made a solution: PR: #893
Add conditions to trigger onTimeChange only when there's a meaningful change in the timeline (i.e., not during a drag)
const handleTimeChange = () => { if (!isDragging) { console.log("onTimeChange"); } };
<Timeline groups={groups} items={items} onItemDrag={() => { setIsDragging(true); console.log("onItemDrag"); }} onTimeChange={handleTimeChange} />
Describe the bug
When dragging an item,
onTimeChange
is called just beforeonItemDrag
. This happens only randomly.In my case this unnecessarily causes reloading of data. When this happens, the moved item gets "recreated" and jumps back to the start position before dragging.
To Reproduce
Sometimes this will print:
Expected behavior
onTimeChange
should not be called before dragging an item.Library Version
"react-calendar-timeline": "0.27.0"
Desktop (please complete the following information):