react-stickynode
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -100,5 +100,4 @@ /** | ||
value: function getTopPosition(top) { | ||
// TODO, topTarget is for current layout, may remove | ||
// a top argument can be provided to override reading from the props | ||
top = top || this.props.top || this.props.topTarget || 0; | ||
top = top || this.props.top || 0; | ||
if (typeof top === 'string') { | ||
@@ -331,8 +330,2 @@ if (!this.topTarget) { | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.updateInitialDimension(nextProps); | ||
this.update(); | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
@@ -345,14 +338,22 @@ value: function componentDidUpdate(prevProps, prevState) { | ||
} | ||
// if the props for enabling are toggled, then trigger the update or reset depending on the current props | ||
if (prevProps.enabled !== this.props.enabled) { | ||
if (this.props.enabled) { | ||
this.setState({ activated: true }, function () { | ||
_this.updateInitialDimension(); | ||
_this.update(); | ||
}); | ||
} else { | ||
this.setState({ activated: false }, function () { | ||
_this.reset(); | ||
}); | ||
var arePropsChanged = !(0, _shallowequal2['default'])(this.props, prevProps); | ||
if (arePropsChanged) { | ||
// if the props for enabling are toggled, then trigger the update or reset depending on the current props | ||
if (prevProps.enabled !== this.props.enabled) { | ||
if (this.props.enabled) { | ||
this.setState({ activated: true }, function () { | ||
_this.updateInitialDimension(); | ||
_this.update(); | ||
}); | ||
} else { | ||
this.setState({ activated: false }, function () { | ||
_this.reset(); | ||
}); | ||
} | ||
} | ||
// if the top or bottomBoundary props were changed, then trigger the update | ||
else if (prevProps.top !== this.props.top || prevProps.bottomBoundary !== this.props.bottomBoundary) { | ||
this.updateInitialDimension(); | ||
this.update(); | ||
} | ||
} | ||
@@ -447,3 +448,3 @@ } | ||
_this2.innerElement = inner; | ||
}, className: 'sticky-inner-wrapper', style: innerStyle }, | ||
}, className: ['sticky-inner-wrapper', this.props.innerClass].join(' '), style: innerStyle }, | ||
typeof children === 'function' ? children({ status: this.state.status }) : children | ||
@@ -470,3 +471,4 @@ ) | ||
releasedClass: 'released', | ||
onStateChange: null | ||
onStateChange: null, | ||
innerClass: '' | ||
}; | ||
@@ -489,2 +491,3 @@ | ||
releasedClass: _propTypes2['default'].string, | ||
innerClass: _propTypes2['default'].string, | ||
onStateChange: _propTypes2['default'].func, | ||
@@ -491,0 +494,0 @@ shouldFreeze: _propTypes2['default'].func, |
{ | ||
"name": "react-stickynode", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "A performant and comprehensive React sticky", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -57,2 +57,3 @@ # react-stickynode | ||
| `activeClass` | String | Class name to be applied to the element when the sticky state is active (`active` by default). | | ||
| `innerClass` | String | Class name to be applied to the inner element (`''` by default). | | ||
| `releasedClass` | String | Class name to be applied to the element when the sticky state is released (`released` by default). | | ||
@@ -59,0 +60,0 @@ | `onStateChange` | Function | Callback for when the sticky state changes. See below. | |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
754
125
0
42567
7