react-now-you-see-me
Advanced tools
Comparing version 1.4.5 to 1.5.0
@@ -79,7 +79,13 @@ 'use strict'; | ||
this.mounted = true; | ||
var _props = this.props, | ||
threshold = _props.threshold, | ||
boundingLeft = _props.boundingLeft, | ||
boundingRight = _props.boundingRight, | ||
isFullyContained = _props.isFullyContained; | ||
this.isInViewport = (0, _util.inViewport)({ | ||
threshold: this.props.threshold, | ||
boundingLeft: this.props.boundingLeft, | ||
boundingRight: this.props.boundingRight, | ||
requireEntireElementInViewport: true | ||
threshold: threshold, | ||
boundingLeft: boundingLeft, | ||
boundingRight: boundingRight, | ||
isFullyContained: isFullyContained | ||
}); | ||
@@ -98,9 +104,10 @@ this.checkIsInView(); | ||
value: function componentDidUpdate(prevProps) { | ||
var _props = this.props, | ||
threshold = _props.threshold, | ||
debounce = _props.debounce, | ||
boundingLeft = _props.boundingLeft, | ||
boundingRight = _props.boundingRight; | ||
var _props2 = this.props, | ||
threshold = _props2.threshold, | ||
debounce = _props2.debounce, | ||
boundingLeft = _props2.boundingLeft, | ||
boundingRight = _props2.boundingRight, | ||
isFullyContained = _props2.isFullyContained; | ||
if (prevProps.threshold !== threshold || prevProps.boundingLeft !== boundingLeft || prevProps.boundingRight !== boundingRight) { | ||
if (prevProps.threshold !== threshold || prevProps.boundingLeft !== boundingLeft || prevProps.boundingRight !== boundingRight || prevProps.isFullyContained !== isFullyContained) { | ||
this.isInViewport = (0, _util.inViewport)({ | ||
@@ -110,3 +117,3 @@ threshold: threshold, | ||
boundingRight: boundingRight, | ||
requireEntireElementInViewport: true | ||
isFullyContained: isFullyContained | ||
}); | ||
@@ -131,4 +138,5 @@ } | ||
threshold: 0, | ||
once: false | ||
once: false, | ||
isFullyContained: true | ||
}; | ||
exports.default = InView; |
@@ -28,3 +28,3 @@ 'use strict'; | ||
var isBoundingClientRectInRange = function isBoundingClientRectInRange(_ref) { | ||
var isBoundingClientRectInRange = exports.isBoundingClientRectInRange = function isBoundingClientRectInRange(_ref) { | ||
var targetRect = _ref.targetRect, | ||
@@ -36,3 +36,3 @@ boundingRect = _ref.boundingRect, | ||
var vertBounds = isBetween(boundingRect.top, boundingRect.bottom); | ||
return fullyContained ? horizBounds(targetRect.left) && horizBounds(targetRect.right) && vertBounds(targetRect.top) && vertBounds(targetRect.bottom) : horizBounds(targetRect.left) || horizBounds(targetRect.right) || vertBounds(targetRect.top) || vertBounds(targetRect.bottom); | ||
return fullyContained ? horizBounds(targetRect.left) && horizBounds(targetRect.right) && vertBounds(targetRect.top) && vertBounds(targetRect.bottom) : horizBounds(targetRect.left) && (vertBounds(targetRect.top) || vertBounds(targetRect.bottom)) || horizBounds(targetRect.right) && (vertBounds(targetRect.top) || vertBounds(targetRect.bottom)) || vertBounds(targetRect.top) && (horizBounds(targetRect.left) || horizBounds(targetRect.right)) || vertBounds(targetRect.bottom) && (horizBounds(targetRect.left) || horizBounds(targetRect.right)); | ||
}; | ||
@@ -50,4 +50,4 @@ | ||
boundingRight = _ref2.boundingRight, | ||
_ref2$requireEntireEl = _ref2.requireEntireElementInViewport, | ||
requireEntireElementInViewport = _ref2$requireEntireEl === undefined ? false : _ref2$requireEntireEl; | ||
_ref2$isFullyContaine = _ref2.isFullyContained, | ||
isFullyContained = _ref2$isFullyContaine === undefined ? false : _ref2$isFullyContaine; | ||
@@ -69,5 +69,5 @@ return function (element) { | ||
}, | ||
fullyContained: requireEntireElementInViewport | ||
fullyContained: isFullyContained | ||
}); | ||
}; | ||
}; |
{ | ||
"name": "react-now-you-see-me", | ||
"description": "A React component for determining when an element is within a given threshold of the viewport, horizontally.", | ||
"version": "1.4.5", | ||
"version": "1.5.0", | ||
"author": "Jane Web Team", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
14625
184