Skip to content

Add scroll reach bottom api for lazy loading usage #1824

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

Closed
wants to merge 3 commits into from

Conversation

qili26
Copy link
Contributor

@qili26 qili26 commented Nov 15, 2019

scrollReachBottom

@qili26 qili26 self-assigned this Nov 15, 2019
@@ -29,4 +29,5 @@
.rdg-grid {
// min-height is here to show the horizontal scrollbar when there are no rows
min-height: 1px;
margin-bottom: 8px;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add small space between the bottom row and the bottom border, as the editable small square will increase the height size a little bit, so it's better to leave the margin in advance to avoid some randomly bug that a cell cannot be edited.

image

@@ -110,6 +110,12 @@ export default function Canvas<R, K extends keyof R>({
}
}, [rowHeight, scrollToRowIndex]);

useEffect(() => {
if (scrollTop + clientHeight - rowHeight * rowsCount === 8) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -254,6 +254,10 @@ export interface ScrollPosition {
scrollTop: number;
}

export interface ScrollOption extends ScrollPosition {
reachedBottom?: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to revisit the API name, but I believe this should be a reasonable API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or should I add a stand alone API like onReachedBottom to be explicitly?

@nstepien
Copy link
Contributor

nstepien commented Dec 5, 2019

Why not just surface the scroll event object, then users can just check for themselves:

event.target.clientHeight + event.target.scrollTop === event.target.scrollHeight

@qili26
Copy link
Contributor Author

qili26 commented Dec 27, 2019

blocked by #1852

@qili26
Copy link
Contributor Author

qili26 commented Jan 2, 2020

Superseded by this #1854

@qili26 qili26 closed this Jan 2, 2020
@qili26 qili26 deleted the ql-lazy-loading branch January 2, 2020 19:21
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.

2 participants