Closed rayliverified closed 4 years ago
in theory, the scroll to index won't queued up the many invocations for same index. since the first one will bring the row into the expected position, the later same commands will return soon right after invoked. for canceling, because the searching is in processing and may only consume very short duration (I supposed it won't spent more than 5 seconds except the super worst case), cancel is not relatively good solution for me.
may I ask what's the worst scrolling duration in your case? for same index? if you just want to prevent the same index scrolling for the queue, you can simply add an extension function as a wrapper and drop the later invocations before the first one ended.
for the isAutoScrolling, you may provide the reproduce case. :)
Thanks for the quick reply. I'll create a reproduction case tomorrow!
The situation I'm experiencing the queued scrolling is in a long list with 5-10 scrollToIndex
being called in a second. This happens because a lot of events are triggered OR the events are triggered while the app is in the background. Once the app resumes, the scroll events are all called at once.
for both cases, you can try to merge them into one request (maybe only keep latest one and invoked followed by the previous invocation if any) in the extension wrapper function.
Still active, going to create the test case today.
Closing for now due to not having time to present a good solution.
Thank you so much for this wonderful library. It has been a lifesaver and the highlight feature is exceptional!
Is there a way to cancel in flight scrolls? Because scrollToIndex is asynchronous, sometimes too many scrolls get queued up.
Ideally there's a way to get a list of active scrolls and then cancel them.
On a side note,
isAutoScrolling
does not always return the correct value when multiplescrollToIndex
are called.I'm happy to dig a bit more in depth and make a PR if you're available for answering some ScrollPosition questions. I've done a bit of research and have some experience here thanks to some synchronizing scroll work.