Comparing version
@@ -7,3 +7,3 @@ import React, { Component, ReactNode, Ref } from 'react'; | ||
renderPlaceholder: RenderFuncWithRef; | ||
} & Partial<Pick<InViewProps, 'offsetBottom' | 'offsetTop' | 'throttle'>>; | ||
} & Partial<Pick<InViewProps, 'offsetBottom' | 'offsetLeft' | 'offsetRight' | 'offsetTop' | 'throttle'>>; | ||
declare type State = { | ||
@@ -10,0 +10,0 @@ isInViewport: boolean; |
@@ -40,3 +40,3 @@ import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return nextProps.children !== this.props.children || nextProps.offsetBottom !== this.props.offsetBottom || nextProps.offsetTop !== this.props.offsetTop || nextProps.renderPlaceholder !== this.props.renderPlaceholder || nextProps.throttle !== this.props.throttle || nextState.isInViewport !== this.state.isInViewport; | ||
return nextProps.children !== this.props.children || nextProps.offsetBottom !== this.props.offsetBottom || nextProps.offsetLeft !== this.props.offsetLeft || nextProps.offsetRight !== this.props.offsetRight || nextProps.offsetTop !== this.props.offsetTop || nextProps.renderPlaceholder !== this.props.renderPlaceholder || nextProps.throttle !== this.props.throttle || nextState.isInViewport !== this.state.isInViewport; | ||
} | ||
@@ -48,2 +48,4 @@ }, { | ||
offsetBottom = _this$props.offsetBottom, | ||
offsetLeft = _this$props.offsetLeft, | ||
offsetRight = _this$props.offsetRight, | ||
offsetTop = _this$props.offsetTop, | ||
@@ -56,2 +58,4 @@ renderPlaceholder = _this$props.renderPlaceholder, | ||
offsetBottom: offsetBottom, | ||
offsetLeft: offsetLeft, | ||
offsetRight: offsetRight, | ||
offsetTop: offsetTop, | ||
@@ -58,0 +62,0 @@ onChange: this.handleChange, |
@@ -45,3 +45,3 @@ 'use strict'; | ||
value: function shouldComponentUpdate(nextProps, nextState) { | ||
return nextProps.children !== this.props.children || nextProps.offsetBottom !== this.props.offsetBottom || nextProps.offsetTop !== this.props.offsetTop || nextProps.renderPlaceholder !== this.props.renderPlaceholder || nextProps.throttle !== this.props.throttle || nextState.isInViewport !== this.state.isInViewport; | ||
return nextProps.children !== this.props.children || nextProps.offsetBottom !== this.props.offsetBottom || nextProps.offsetLeft !== this.props.offsetLeft || nextProps.offsetRight !== this.props.offsetRight || nextProps.offsetTop !== this.props.offsetTop || nextProps.renderPlaceholder !== this.props.renderPlaceholder || nextProps.throttle !== this.props.throttle || nextState.isInViewport !== this.state.isInViewport; | ||
} | ||
@@ -53,2 +53,4 @@ }, { | ||
offsetBottom = _this$props.offsetBottom, | ||
offsetLeft = _this$props.offsetLeft, | ||
offsetRight = _this$props.offsetRight, | ||
offsetTop = _this$props.offsetTop, | ||
@@ -61,2 +63,4 @@ renderPlaceholder = _this$props.renderPlaceholder, | ||
offsetBottom: offsetBottom, | ||
offsetLeft: offsetLeft, | ||
offsetRight: offsetRight, | ||
offsetTop: offsetTop, | ||
@@ -63,0 +67,0 @@ onChange: this.handleChange, |
{ | ||
"name": "lazy-child", | ||
"description": "React component that renders its child when it enters the viewport", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -73,3 +73,3 @@ "author": "Wyatt Johnston <w@wyatt.page>", | ||
"@babel/runtime": "^7.0.0", | ||
"react-peekaboo": "^0.2.1" | ||
"react-peekaboo": "^0.3.0" | ||
}, | ||
@@ -76,0 +76,0 @@ "peerDependencies": { |
@@ -53,2 +53,22 @@ # `lazy-child` | ||
##### `offsetLeft?: number` | ||
Passed to the wrapped [react-peekaboo](https://github.com/wpj/react-peekaboo) | ||
instance. | ||
Number of pixels to add to the left of the area checked against when computing | ||
in view elements. | ||
Default: `0` | ||
##### `offsetRight?: number` | ||
Passed to the wrapped [react-peekaboo](https://github.com/wpj/react-peekaboo) | ||
instance. | ||
Number of pixels to add to the right of the area checked against when computing | ||
in view elements. | ||
Default: `0` | ||
##### `offsetTop?: number` | ||
@@ -55,0 +75,0 @@ |
10815
10.42%139
6.11%98
25.64%+ Added
- Removed
Updated