Skip to content

Commit

Permalink
Release 0.0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
tinder-rhsiao committed Apr 16, 2018
1 parent b08b160 commit 569a653
Show file tree
Hide file tree
Showing 3 changed files with 2,231 additions and 867 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-in-viewport",
"version": "0.0.20",
"version": "0.0.21",
"description": "Track React component in viewport",
"author": "Roderick Hsiao <roderickhsiao@gmail.com>",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ function handleViewport(
handleIntersection(entries) {
const { onEnterViewport, onLeaveViewport } = this.props;
const entry = entries[0] || {};
const inViewport = entry.isIntersecting;
const { isIntersecting, intersectionRatio } = entry;
const inViewport = (typeof isIntersecting !== 'undefined') ? isIntersecting : (intersectionRatio > 0);

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

0 comments on commit 569a653

Please sign in to comment.