m-list-view icon indicating copy to clipboard operation
m-list-view copied to clipboard

throttle function does not work on my Android device

Open AleCaste opened this issue 7 years ago • 5 comments

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!

AleCaste avatar Sep 25 '17 00:09 AleCaste

What is your rmc-list-view version?

cc @zhang740 this issue is concerned.

warmhug avatar Sep 25 '17 02:09 warmhug

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 avatar Sep 25 '17 12:09 AleCaste

@AleCaste The lastest version is rewrite this, is resolved?

zhang740 avatar Oct 23 '17 04:10 zhang740

Hello! I tested v0.11.1 and it definitely works. You may close this issue now. Thanks! (by the way, great library!)

AleCaste avatar Oct 23 '17 12:10 AleCaste

😶 @AleCaste You should be right, our original throttle function has a problem.

warmhug avatar Oct 23 '17 15:10 warmhug