hooks icon indicating copy to clipboard operation
hooks copied to clipboard

Infinity scroll for document/window with useRequest

Open albusphan opened this issue 5 years ago • 2 comments

Hi there, thank you for creating such a great hook. Don't know if it is best practice or not but I tried to use this to implement infinity scroll for Document but it not work

Might think because this condition did not match when using window object.

const scrollMethod = () => { if (loading || loadingMore || !ref || !ref.current) { return; } if (ref.current.scrollHeight - ref.current.scrollTop <= ref.current.clientHeight + threshold) { loadMore(); } };

albusphan avatar Jan 11 '21 03:01 albusphan

Now useRequest just support listen the children node scroll, don't support parent node scroll.

We will support this feature as soon as.

Thank you for your feedback~

brickspert avatar May 07 '21 02:05 brickspert

Hello:

这个问题我们已经在 v3.0 版本彻底修复,目前 v3.0 版本已经发布 alpha 版本。

欢迎试用。

文档:https://ahooks-next.surge.sh/ 源码:https://github.com/alibaba/hooks/tree/next

安装最新分支

$ npm install --save ahooks@next
# or
$ yarn add ahooks@next

We have fixed this problem in the v3.0 version, and the alpha has been released.

Welcome to try.

Doc:https://ahooks-next.surge.sh/ Source Code:https://github.com/alibaba/hooks/tree/next

Install v3.0

$ npm install --save ahooks@next
# or
$ yarn add ahooks@next

brickspert avatar Nov 11 '21 14:11 brickspert