m-list-view
m-list-view copied to clipboard
throttle function does not work on my Android device
Hello,
The throttle
function that is found on [project]/es/util.js
does not seem to work on my Android device when making the listview scroll with a single fast touch gesture. The _onScroll
handler is executed just once when the listview start scrolling (right after the touch gesture is performed) but then the listview start scrolling but no further _onScroll
calls are registered.
For some reason the throttle
function that is being used is NOT triggering calls every _this.props.scrollEventThrottle
milliseconds.
On my desktop PC everything seems to be working well though.
I tried to replace the throttle function with this version I found here:
https://stackoverflow.com/a/27078401/3621841
... and this indeed works perfectly on both my desktop PC and my Android device.
So it seems this is a better function to use and I would like to ask you if you can make the change on the official version of the library if all your tests are passed. Please let me know. Thanks a lot!
What is your rmc-list-view version?
cc @zhang740 this issue is concerned.
I forgot to mention that. Version 0.8.6
The throttle function being used on this version is this one:
export function throttle(fn, delay) {
var allowSample = true;
return function _throttle(e) {
if (allowSample) {
allowSample = false;
setTimeout(function () {
allowSample = true;
}, delay);
fn(e);
}
};
}
And, as I said, this function is not working on my Android device when using Chrome. It only calls fn
once.
@AleCaste The lastest version is rewrite this, is resolved?
Hello! I tested v0.11.1
and it definitely works.
You may close this issue now. Thanks! (by the way, great library!)
😶 @AleCaste You should be right, our original throttle function has a problem.