-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
…roll reached to bottom
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -110,6 +110,12 @@ export default function Canvas<R, K extends keyof R>({ | |||
} | |||
}, [rowHeight, scrollToRowIndex]); | |||
|
|||
useEffect(() => { | |||
if (scrollTop + clientHeight - rowHeight * rowsCount === 8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8
is corresponding to this line.
@@ -254,6 +254,10 @@ export interface ScrollPosition { | |||
scrollTop: number; | |||
} | |||
|
|||
export interface ScrollOption extends ScrollPosition { | |||
reachedBottom?: boolean; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
Why not just surface the scroll event object, then users can just check for themselves: event.target.clientHeight + event.target.scrollTop === event.target.scrollHeight |
blocked by #1852 |
Superseded by this #1854 |
Uh oh!
There was an error while loading. Please reload this page.