Scroll up call refresh handler every time in multiple.html demo using 0.1.16
See original GitHub issueBug report
In our mobile app, after upgrading from 0.1.14 to 0.1.16, the scrollbar will trigger the onRefresh handler every time users touch and drag up even though the view is not at the very top.
I believe the code here makes trouble, the this.mainElement.scrollTop
always return 0 each time scroll to be dragged up. However, using the old way, it works fine.
shouldPullToRefresh: function shouldPullToRefresh() {
return typeof this.mainElement === 'string' ? !document.querySelector(this.mainElement).scrollTop : this.mainElement && !this.mainElement.scrollTop;
// return !window.scrollY
},
Current behavior: Calling refresh handler every time when scrolling up the page. Expected behavior: Not calling refresh handler when each time scroll up.
JSFiddle URL for the demo with bug: This bug can be reproduced by tweaking the demo which is multiple.html, looks like the demo still using the old version, by replacing the pulltorefresh.js with the latest 0.1.16, the issue can be observed https://jsfiddle.net/bqc3jnds/ Browsers affected: Chrome dev tool in mobile mode and real devices
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
I would also like this issue to get addressed. Currently, I’m providing previous default value manually.
Gotcha, definitely this will depend on how you’re building your layout, the default behaviour will not satisfy all needs as layouts can be built in many different ways.
We can go back to the previous default for
shouldPullToRefresh
but that will also break other’s users setups and such.The best solution so far is providing a callback that fits to your layout logic.
So much thanks for your feedback!