react-infinite-scroll-component icon indicating copy to clipboard operation
react-infinite-scroll-component copied to clipboard

修复当滚动到底部时,下拉刷新功能失效的问题

Open hangfgithub opened this issue 8 months ago • 3 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-infinite-scroll-component/dist/index.es.js b/node_modules/react-infinite-scroll-component/dist/index.es.js
index 628595f..d6182dc 100644
--- a/node_modules/react-infinite-scroll-component/dist/index.es.js
+++ b/node_modules/react-infinite-scroll-component/dist/index.es.js
@@ -287,6 +287,8 @@ var InfiniteScroll = /** @class */ (function (_super) {
                 : document.documentElement.scrollTop
                     ? document.documentElement
                     : document.body;
+            // 修复当滚动到底部时,下拉刷新功能失效的问题
+            _this.lastScrollTop = target.scrollTop;
             // return immediately if the action has already been triggered,
             // prevents multiple triggers.
             if (_this.actionTriggered)
@@ -300,7 +302,6 @@ var InfiniteScroll = /** @class */ (function (_super) {
                 _this.setState({ showLoader: true });
                 _this.props.next && _this.props.next();
             }
-            _this.lastScrollTop = target.scrollTop;
         };
         _this.state = {
             showLoader: false,
diff --git a/node_modules/react-infinite-scroll-component/dist/index.js b/node_modules/react-infinite-scroll-component/dist/index.js
index a51bb4c..642d3dc 100644
--- a/node_modules/react-infinite-scroll-component/dist/index.js
+++ b/node_modules/react-infinite-scroll-component/dist/index.js
@@ -292,6 +292,8 @@ var InfiniteScroll = /** @class */ (function (_super) {
                 : document.documentElement.scrollTop
                     ? document.documentElement
                     : document.body;
+            // 修复当滚动到底部时,下拉刷新功能失效的问题
+            _this.lastScrollTop = target.scrollTop;
             // return immediately if the action has already been triggered,
             // prevents multiple triggers.
             if (_this.actionTriggered)
@@ -305,7 +307,6 @@ var InfiniteScroll = /** @class */ (function (_super) {
                 _this.setState({ showLoader: true });
                 _this.props.next && _this.props.next();
             }
-            _this.lastScrollTop = target.scrollTop;
         };
         _this.state = {
             showLoader: false,

This issue body was partially generated by patch-package.

hangfgithub avatar Apr 14 '25 09:04 hangfgithub

我也遇到了相同的问题 应该如何解决?

Zeoy2020 avatar May 27 '25 02:05 Zeoy2020

@Zeoy2020

Image

看一下 你的 div 是否 与InfiniteScroll height 设置一样的值 我这边看是可以触发的

Sun-Liu avatar Nov 20 '25 07:11 Sun-Liu