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

react-sticky

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-sticky - npm Package Compare versions

Comparing version 4.0.1 to 4.0.2

12

lib/sticky.js

@@ -37,6 +37,7 @@ 'use strict';

var pageY = window.pageYOffset;
var origin = _this.getOrigin(pageY);
var isSticky = _this.isSticky(pageY, _this.state.origin);
var hasChanged = _this.state.isSticky !== isSticky;
_this.setState({ isSticky: isSticky });
_this.setState({ isSticky: isSticky, origin: origin });
_this.context.container.updateOffset(isSticky ? _this.state.height : 0);

@@ -49,3 +50,3 @@

var height = _reactDom2.default.findDOMNode(_this).getBoundingClientRect().height;
var origin = _this.refs.placeholder.getBoundingClientRect().top + window.pageYOffset;
var origin = _this.getOrigin(window.pageYOffset);
_this.setState({ height: height, origin: origin });

@@ -79,2 +80,7 @@ };

}, {
key: 'getOrigin',
value: function getOrigin(pageY) {
return this.refs.placeholder.getBoundingClientRect().top + pageY;
}
}, {
key: 'update',

@@ -84,3 +90,3 @@ value: function update() {

var pageY = window.pageYOffset;
var origin = this.refs.placeholder.getBoundingClientRect().top + pageY;
var origin = this.getOrigin(pageY);
var isSticky = this.isSticky(pageY, origin);

@@ -87,0 +93,0 @@ this.setState({ height: height, origin: origin, isSticky: isSticky });

{
"name": "react-sticky",
"version": "4.0.1",
"version": "4.0.2",
"description": "Sticky component for React",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -63,2 +63,3 @@ react-sticky [![Build Status](https://travis-ci.org/captivationsoftware/react-sticky.svg?branch=master)](https://travis-ci.org/captivationsoftware/react-sticky)

```
Note that the calculation of the Sticky element's height does not currently take margins into account. If you have margins on this element it may result in unexpected behavior.

@@ -65,0 +66,0 @@ ### `<StickyContainer />` Props

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