Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(useInfiniteScroll): support scroll to top #2565

Merged
merged 8 commits into from
Sep 26, 2024

Conversation

jaluik
Copy link
Contributor

@jaluik jaluik commented Jun 10, 2024

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

In many scenarios, users need to load more content when they scroll up, especially in chat applications and feeds. The current useInfiniteScroll hook in ahooks only supports loading more when scrolling down. To meet this requirement, I have extended useInfiniteScroll to support upwards infinite scrolling.

Solution:

  • Added an option direction: top to useInfiniteScroll to enable upward scrolling.
  • Modified the internal logic to handle upward scroll events and load more data accordingly.
  • Ensured backward compatibility with existing downward scrolling functionality.

📝 Changelog

Language Changelog
🇺🇸 English Added direction option to useInfiniteScroll hook to enable upward scrolling.
🇨🇳 Chinese useInfiniteScroll 增加了direction选项提供向上滚动加载的支持。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@CLAassistant
Copy link

CLAassistant commented Jun 10, 2024

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 3 committers have signed the CLA.

✅ jaluik
✅ hchlq
❌ crazylxr
You have signed the CLA already but the status is still pending? Let us recheck it.

@hchlq
Copy link
Collaborator

hchlq commented Jun 12, 2024

补一下单侧哈

@jaluik
Copy link
Contributor Author

jaluik commented Jun 12, 2024

补一下单侧哈

ok

@jaluik
Copy link
Contributor Author

jaluik commented Jun 12, 2024

补一下单侧哈

单测加好了 @hchlq

@jaluik
Copy link
Contributor Author

jaluik commented Jun 29, 2024

@liuyib @hchlq 有人review一下代码吗

@crazylxr crazylxr merged commit 299fa2a into alibaba:master Sep 26, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants