Skip to content

Commit

Permalink
add offset to make infinite scrolling feel smoother
Browse files Browse the repository at this point in the history
  • Loading branch information
vishadGoyal committed Oct 10, 2020
1 parent 3a5292c commit 3160e9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/SongList.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function SongList() {
if (!el) {
return false;
}
const result = el.getBoundingClientRect().bottom <= window.innerHeight && window.scrollY > lastScrollPosition;
const result = (el.getBoundingClientRect().bottom - 500) <= window.innerHeight && window.scrollY > lastScrollPosition;
lastScrollPosition = window.scrollY;
return result;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ function SongList() {
))}
</div>
{ songFetchMoreRunning &&
[...Array(10)].map((i, j) => (
[...Array(2)].map((i, j) => (
<SkeletonList key={j} />
))
}
Expand Down

0 comments on commit 3160e9c

Please sign in to comment.