Skip to content

Commit

Permalink
always listen for scroll events, especially on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
gostrega committed Sep 26, 2018
1 parent 0fcc42d commit 4b946ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/internal/ScrollCaptor.js
Expand Up @@ -25,7 +25,8 @@ class ScrollCaptor extends Component<CaptorProps> {
}
startListening(el: HTMLElement) {
// bail early if no scroll available
if (el.scrollHeight <= el.clientHeight) return;
// Always listen for scroll
//if (el.scrollHeight <= el.clientHeight) return;

// all the if statements are to appease Flow 😢
if (typeof el.addEventListener === 'function') {
Expand All @@ -40,7 +41,8 @@ class ScrollCaptor extends Component<CaptorProps> {
}
stopListening(el: HTMLElement) {
// bail early if no scroll available
if (el.scrollHeight <= el.clientHeight) return;
// Always listen for scroll
//if (el.scrollHeight <= el.clientHeight) return;

// all the if statements are to appease Flow 😢
if (typeof el.removeEventListener === 'function') {
Expand Down

0 comments on commit 4b946ce

Please sign in to comment.