ScrollableList: don't call onLoadMore() unless it hasMore
This commit is contained in:
parent
c4f7106b77
commit
bcb8d75f71
1 changed files with 7 additions and 1 deletions
|
@ -104,6 +104,12 @@ const ScrollableList: React.FC<IScrollableList> = ({
|
|||
}
|
||||
};
|
||||
|
||||
const handleEndReached = () => {
|
||||
if (hasMore && onLoadMore) {
|
||||
onLoadMore();
|
||||
}
|
||||
};
|
||||
|
||||
/** Render the actual Virtuoso list */
|
||||
const renderFeed = (): JSX.Element => (
|
||||
<Virtuoso
|
||||
|
@ -111,7 +117,7 @@ const ScrollableList: React.FC<IScrollableList> = ({
|
|||
className={className}
|
||||
data={data}
|
||||
startReached={onScrollToTop}
|
||||
endReached={onLoadMore}
|
||||
endReached={handleEndReached}
|
||||
isScrolling={isScrolling => isScrolling && onScroll && onScroll()}
|
||||
itemContent={renderItem}
|
||||
context={{
|
||||
|
|
Loading…
Reference in a new issue