react-intersection-observer
Advanced tools
Comparing version 9.5.0 to 9.5.1
51
index.js
@@ -9,3 +9,2 @@ "use strict"; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __export = (target, all) => { | ||
@@ -32,6 +31,2 @@ for (var name in all) | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
@@ -144,25 +139,2 @@ // src/index.tsx | ||
super(props); | ||
__publicField(this, "node", null); | ||
__publicField(this, "_unobserveCb", null); | ||
__publicField(this, "handleNode", (node) => { | ||
if (this.node) { | ||
this.unobserve(); | ||
if (!node && !this.props.triggerOnce && !this.props.skip) { | ||
this.setState({ inView: !!this.props.initialInView, entry: void 0 }); | ||
} | ||
} | ||
this.node = node ? node : null; | ||
this.observeNode(); | ||
}); | ||
__publicField(this, "handleChange", (inView, entry) => { | ||
if (inView && this.props.triggerOnce) { | ||
this.unobserve(); | ||
} | ||
if (!isPlainChildren(this.props)) { | ||
this.setState({ inView, entry }); | ||
} | ||
if (this.props.onChange) { | ||
this.props.onChange(inView, entry); | ||
} | ||
}); | ||
this.state = { | ||
@@ -183,2 +155,4 @@ inView: !!props.initialInView, | ||
} | ||
node = null; | ||
_unobserveCb = null; | ||
observeNode() { | ||
@@ -216,2 +190,23 @@ if (!this.node || this.props.skip) | ||
} | ||
handleNode = (node) => { | ||
if (this.node) { | ||
this.unobserve(); | ||
if (!node && !this.props.triggerOnce && !this.props.skip) { | ||
this.setState({ inView: !!this.props.initialInView, entry: void 0 }); | ||
} | ||
} | ||
this.node = node ? node : null; | ||
this.observeNode(); | ||
}; | ||
handleChange = (inView, entry) => { | ||
if (inView && this.props.triggerOnce) { | ||
this.unobserve(); | ||
} | ||
if (!isPlainChildren(this.props)) { | ||
this.setState({ inView, entry }); | ||
} | ||
if (this.props.onChange) { | ||
this.props.onChange(inView, entry); | ||
} | ||
}; | ||
render() { | ||
@@ -218,0 +213,0 @@ const { children } = this.props; |
{ | ||
"name": "react-intersection-observer", | ||
"version": "9.5.0", | ||
"version": "9.5.1", | ||
"description": "Monitor if a component is inside the viewport, using IntersectionObserver API", | ||
"source": "./src/index.tsx", | ||
"main": "./index.js", | ||
"module": "./index.mjs", | ||
"module": "./esm/index.js", | ||
"types": "./index.d.ts", | ||
@@ -9,0 +9,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132248
12
1273