From c813c5f3ca07283d4be0e5088e67f2c921b4e0dd Mon Sep 17 00:00:00 2001 From: Andrew Sotiriou Date: Fri, 27 May 2022 10:34:06 -0400 Subject: [PATCH] Andrew s/neg vt issue (#30) * Fixes for neg VT * Update isHidden * Cleanup * Remove log * Update call --- src/Bling.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bling.js b/src/Bling.js index 7393de8..f21a6f5 100644 --- a/src/Bling.js +++ b/src/Bling.js @@ -570,7 +570,13 @@ class Bling extends Component { slotSize, this.viewableThreshold ); - if (inViewport) { + + const isHidden = () => { + const el = ReactDOM.findDOMNode(this); + return el.offsetParent === null || el.style.display === "none"; + }; + + if (inViewport && !isHidden()) { this.setState({inViewport: true}); } }