Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-in-viewport

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-in-viewport - npm Package Compare versions

Comparing version 0.0.32 to 0.0.33

12

dist/es/index.js

@@ -20,7 +20,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var isStateless = function isStateless(Component) {
return typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent);
var isStateless = function isStateless(TargetComponent) {
return typeof TargetComponent === 'function' && !(TargetComponent.prototype && TargetComponent.prototype.isReactComponent);
};
function handleViewport(Component, options) {
function handleViewport(TargetComponent, options) {
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { disconnectOnLeave: false };

@@ -149,4 +149,4 @@

var refProps = isStateless(Component) ? { innerRef: this.setInnerRef } : { ref: this.setRef };
return React.createElement(Component, _extends({}, others, {
var refProps = isStateless(TargetComponent) ? { innerRef: this.setInnerRef } : { ref: this.setRef };
return React.createElement(TargetComponent, _extends({}, others, {
inViewport: this.state.inViewport,

@@ -161,5 +161,5 @@ enterCount: this.state.enterCount,

return hoistNonReactStatic(InViewport, Component);
return hoistNonReactStatic(InViewport, TargetComponent);
}
export default handleViewport;

@@ -36,7 +36,7 @@ 'use strict';

var isStateless = function isStateless(Component) {
return typeof Component === 'function' && !(Component.prototype && Component.prototype.isReactComponent);
var isStateless = function isStateless(TargetComponent) {
return typeof TargetComponent === 'function' && !(TargetComponent.prototype && TargetComponent.prototype.isReactComponent);
};
function handleViewport(Component, options) {
function handleViewport(TargetComponent, options) {
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { disconnectOnLeave: false };

@@ -176,4 +176,4 @@

var refProps = isStateless(Component) ? { innerRef: this.setInnerRef } : { ref: this.setRef };
return _react2.default.createElement(Component, Object.assign({}, others, {
var refProps = isStateless(TargetComponent) ? { innerRef: this.setInnerRef } : { ref: this.setRef };
return _react2.default.createElement(TargetComponent, Object.assign({}, others, {
inViewport: this.state.inViewport,

@@ -187,5 +187,5 @@ enterCount: this.state.enterCount,

return InViewport;
}(Component);
}(_react.Component);
return (0, _hoistNonReactStatics2.default)(InViewport, Component);
return (0, _hoistNonReactStatics2.default)(InViewport, TargetComponent);
}

@@ -192,0 +192,0 @@

{
"name": "react-in-viewport",
"version": "0.0.32",
"version": "0.0.33",
"description": "Track React component in viewport",

@@ -5,0 +5,0 @@ "author": "Roderick Hsiao <roderickhsiao@gmail.com>",

@@ -10,9 +10,9 @@ if (typeof window !== 'undefined') {

const isStateless = (Component) => (
typeof Component === 'function'
&& !(Component.prototype && Component.prototype.isReactComponent)
const isStateless = (TargetComponent) => (
typeof TargetComponent === 'function'
&& !(TargetComponent.prototype && TargetComponent.prototype.isReactComponent)
)
function handleViewport(
Component,
TargetComponent,
options,

@@ -131,7 +131,7 @@ config = { disconnectOnLeave: false }

const refProps = isStateless(Component)
const refProps = isStateless(TargetComponent)
? { innerRef: this.setInnerRef }
: { ref: this.setRef };
return (
<Component
<TargetComponent
{...others}

@@ -146,5 +146,5 @@ inViewport={this.state.inViewport}

}
return hoistNonReactStatic(InViewport, Component);
return hoistNonReactStatic(InViewport, TargetComponent);
}
export default handleViewport;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc