Skip to content

Commit

Permalink
use isIntersecting to check if entry is in viewport instead of inters…
Browse files Browse the repository at this point in the history
…ectionRatio (#5)

lgtm
  • Loading branch information
tinder-salinawu authored and roderickhsiao committed Apr 16, 2018
1 parent beed386 commit b08b160
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ function handleViewport(
handleIntersection(entries) {
const { onEnterViewport, onLeaveViewport } = this.props;
const entry = entries[0] || {};
const { intersectionRatio } = entry;
const inViewport = intersectionRatio > 0;
const inViewport = entry.isIntersecting;

// enter
if (!this.intersected && inViewport) {
Expand Down

0 comments on commit b08b160

Please sign in to comment.