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

react-scroll-sticky

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scroll-sticky - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

3

dist/index.d.ts

@@ -1,2 +0,3 @@

export * as ScrollSticky from './scroll_sticky/ScrollSticky';
import _ScrollSticky from './scroll_sticky/ScrollSticky';
export { useScrollSticky } from './useScrollSticky';
export declare const ScrollSticky: typeof _ScrollSticky;

@@ -26,7 +26,2 @@ var React = require('react');

var ScrollSticky$1 = {
__proto__: null,
'default': ScrollSticky
};
function useMounted() {

@@ -73,7 +68,9 @@ var _useState = React.useState(true),

_ref$header_head = _ref.header_head,
header_head = _ref$header_head === void 0 ? 70 : _ref$header_head;
header_head = _ref$header_head === void 0 ? 70 : _ref$header_head,
_ref$detectInnerWidth = _ref.detectInnerWidthIsOk,
detectInnerWidthIsOk = _ref$detectInnerWidth === void 0 ? isInnerWidthOk : _ref$detectInnerWidth;
var ref_main_elm = React.useRef(null);
var ref_fake_elm = React.useRef(null);
var ref_sticky_elm = React.useRef(null);
var ref_is_innerWidth_ok = React.useRef(isInnerWidthOk());
var ref_is_innerWidth_ok = React.useRef(detectInnerWidthIsOk());
var ref_is_href_ok = React.useRef(isHrefOk(sticky_location));

@@ -178,3 +175,3 @@ var has_event_scroll = React.useRef(false);

ref_is_href_ok.current = isHrefOk(sticky_location);
ref_is_innerWidth_ok.current = isInnerWidthOk();
ref_is_innerWidth_ok.current = detectInnerWidthIsOk();
ref_more_height.current = getNewMoreHeight();

@@ -252,3 +249,3 @@

var new_innerWidth_ok = isInnerWidthOk();
var new_innerWidth_ok = detectInnerWidthIsOk();

@@ -291,4 +288,6 @@ if (new_innerWidth_ok) {

var ScrollSticky$1 = ScrollSticky;
exports.ScrollSticky = ScrollSticky$1;
exports.useScrollSticky = useScrollSticky;
//# sourceMappingURL=index.js.map

@@ -26,7 +26,2 @@ import { createElement, useState, useEffect, useRef } from 'react';

var ScrollSticky$1 = {
__proto__: null,
'default': ScrollSticky
};
function useMounted() {

@@ -73,7 +68,9 @@ var _useState = useState(true),

_ref$header_head = _ref.header_head,
header_head = _ref$header_head === void 0 ? 70 : _ref$header_head;
header_head = _ref$header_head === void 0 ? 70 : _ref$header_head,
_ref$detectInnerWidth = _ref.detectInnerWidthIsOk,
detectInnerWidthIsOk = _ref$detectInnerWidth === void 0 ? isInnerWidthOk : _ref$detectInnerWidth;
var ref_main_elm = useRef(null);
var ref_fake_elm = useRef(null);
var ref_sticky_elm = useRef(null);
var ref_is_innerWidth_ok = useRef(isInnerWidthOk());
var ref_is_innerWidth_ok = useRef(detectInnerWidthIsOk());
var ref_is_href_ok = useRef(isHrefOk(sticky_location));

@@ -178,3 +175,3 @@ var has_event_scroll = useRef(false);

ref_is_href_ok.current = isHrefOk(sticky_location);
ref_is_innerWidth_ok.current = isInnerWidthOk();
ref_is_innerWidth_ok.current = detectInnerWidthIsOk();
ref_more_height.current = getNewMoreHeight();

@@ -252,3 +249,3 @@

var new_innerWidth_ok = isInnerWidthOk();
var new_innerWidth_ok = detectInnerWidthIsOk();

@@ -291,3 +288,5 @@ if (new_innerWidth_ok) {

var ScrollSticky$1 = ScrollSticky;
export { ScrollSticky$1 as ScrollSticky, useScrollSticky };
//# sourceMappingURL=index.modern.js.map
/// <reference types="react" />
export declare function useScrollSticky({ sticky_location, header_head }: {
export declare function useScrollSticky({ sticky_location, header_head, detectInnerWidthIsOk }: {
sticky_location?: RegExp | undefined;
header_head?: number | undefined;
detectInnerWidthIsOk?: (() => boolean) | undefined;
}): {

@@ -6,0 +7,0 @@ calculateAgain: () => void;

{
"name": "react-scroll-sticky",
"version": "1.1.0",
"version": "1.1.1",
"description": "react scroll sticky like 'side bar: about' in fb profile posts",

@@ -5,0 +5,0 @@ "author": "",

@@ -16,12 +16,52 @@ # react-scroll-sticky

```tsx
import React, { Component } from 'react'
//
const App = () => {
//
const { calculateAgain, ref_main_elm, ref_sticky_elm, ref_fake_elm } =
useScrollSticky({
sticky_location: /./,
header_head: 0,
detectInnerWidthIsOk: detectInnerWidthIsOk
})
import MyComponent from 'react-scroll-sticky'
import 'react-scroll-sticky/dist/index.css'
//
React.useEffect(() => {
calculateAgain()
}, [calculateAgain])
class Example extends Component {
render() {
return <MyComponent />
// ----
//
function detectInnerWidthIsOk() {
return true
}
//
return (
<div className={styles.main}>
<div className={styles.row}>
<div className={`${styles.left}`}>
<ScrollSticky
ref_main_elm={ref_main_elm}
ref_fake_elm={ref_fake_elm}
ref_sticky_elm={ref_sticky_elm}
>
<div className={styles.preview}>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
</ScrollSticky>
</div>
<div className={`${styles.right}`}></div>
</div>
</div>
)
}
```

@@ -28,0 +68,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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