react-scroll-sticky
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,1 +0,2 @@ | ||
export { useStickyAuto } from './useScrollSticky'; | ||
export * as ScrollSticky from './scroll_sticky/ScrollSticky'; | ||
export { useScrollSticky } from './useScrollSticky'; |
@@ -1,9 +0,37 @@ | ||
var react = require('react'); | ||
var React = require('react'); | ||
var styles = {"sticky":"_24RIA","h_100per":"_3ZX-Y"}; | ||
function ScrollSticky(_ref) { | ||
var ref_main_elm = _ref.ref_main_elm, | ||
ref_fake_elm = _ref.ref_fake_elm, | ||
ref_sticky_elm = _ref.ref_sticky_elm, | ||
_ref$class_sticky = _ref.class_sticky, | ||
class_sticky = _ref$class_sticky === void 0 ? '' : _ref$class_sticky, | ||
_ref$class_main = _ref.class_main, | ||
class_main = _ref$class_main === void 0 ? '' : _ref$class_main, | ||
_ref$children = _ref.children, | ||
children = _ref$children === void 0 ? '' : _ref$children; | ||
return React.createElement("div", { | ||
ref: ref_main_elm, | ||
className: styles.h_100per + " " + class_main | ||
}, React.createElement("div", { | ||
ref: ref_fake_elm | ||
}), React.createElement("div", { | ||
ref: ref_sticky_elm, | ||
className: styles.sticky + " " + class_sticky | ||
}, children)); | ||
} | ||
var ScrollSticky$1 = { | ||
__proto__: null, | ||
'default': ScrollSticky | ||
}; | ||
function useMounted() { | ||
var _useState = react.useState(true), | ||
var _useState = React.useState(true), | ||
mounted = _useState[0], | ||
setMounted = _useState[1]; | ||
react.useEffect(function () { | ||
React.useEffect(function () { | ||
return function () { | ||
@@ -40,3 +68,3 @@ setMounted(false); | ||
function useStickyAuto(_ref) { | ||
function useScrollSticky(_ref) { | ||
var _ref$sticky_location = _ref.sticky_location, | ||
@@ -46,14 +74,14 @@ sticky_location = _ref$sticky_location === void 0 ? /./ : _ref$sticky_location, | ||
header_head = _ref$header_head === void 0 ? 70 : _ref$header_head; | ||
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_href_ok = react.useRef(isHrefOk(sticky_location)); | ||
var has_event_scroll = react.useRef(false); | ||
var ref_more_height = react.useRef(0); | ||
var ref_has_more_height = react.useRef(false); | ||
var ref_scroll_y = react.useRef(0); | ||
var ref_is_last_scroll_down = react.useRef(true); | ||
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_href_ok = React.useRef(isHrefOk(sticky_location)); | ||
var has_event_scroll = React.useRef(false); | ||
var ref_more_height = React.useRef(0); | ||
var ref_has_more_height = React.useRef(false); | ||
var ref_scroll_y = React.useRef(0); | ||
var ref_is_last_scroll_down = React.useRef(true); | ||
var mounted = useMounted(); | ||
react.useEffect(function () { | ||
React.useEffect(function () { | ||
window.addEventListener('resize', handleResize); | ||
@@ -65,3 +93,3 @@ return function () { | ||
}, []); | ||
react.useEffect(function () { | ||
React.useEffect(function () { | ||
handleChangeHref(); | ||
@@ -262,3 +290,4 @@ }, [location.href]); | ||
exports.useStickyAuto = useStickyAuto; | ||
exports.ScrollSticky = ScrollSticky$1; | ||
exports.useScrollSticky = useScrollSticky; | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,31 @@ | ||
import { useState, useEffect, useRef } from 'react'; | ||
import { createElement, useState, useEffect, useRef } from 'react'; | ||
var styles = {"sticky":"_24RIA","h_100per":"_3ZX-Y"}; | ||
function ScrollSticky(_ref) { | ||
var ref_main_elm = _ref.ref_main_elm, | ||
ref_fake_elm = _ref.ref_fake_elm, | ||
ref_sticky_elm = _ref.ref_sticky_elm, | ||
_ref$class_sticky = _ref.class_sticky, | ||
class_sticky = _ref$class_sticky === void 0 ? '' : _ref$class_sticky, | ||
_ref$class_main = _ref.class_main, | ||
class_main = _ref$class_main === void 0 ? '' : _ref$class_main, | ||
_ref$children = _ref.children, | ||
children = _ref$children === void 0 ? '' : _ref$children; | ||
return createElement("div", { | ||
ref: ref_main_elm, | ||
className: styles.h_100per + " " + class_main | ||
}, createElement("div", { | ||
ref: ref_fake_elm | ||
}), createElement("div", { | ||
ref: ref_sticky_elm, | ||
className: styles.sticky + " " + class_sticky | ||
}, children)); | ||
} | ||
var ScrollSticky$1 = { | ||
__proto__: null, | ||
'default': ScrollSticky | ||
}; | ||
function useMounted() { | ||
@@ -40,3 +68,3 @@ var _useState = useState(true), | ||
function useStickyAuto(_ref) { | ||
function useScrollSticky(_ref) { | ||
var _ref$sticky_location = _ref.sticky_location, | ||
@@ -260,3 +288,3 @@ sticky_location = _ref$sticky_location === void 0 ? /./ : _ref$sticky_location, | ||
export { useStickyAuto }; | ||
export { ScrollSticky$1 as ScrollSticky, useScrollSticky }; | ||
//# sourceMappingURL=index.modern.js.map |
/// <reference types="react" /> | ||
export declare function useStickyAuto({ sticky_location, header_head }: { | ||
export declare function useScrollSticky({ sticky_location, header_head }: { | ||
sticky_location?: RegExp | undefined; | ||
@@ -4,0 +4,0 @@ header_head?: number | undefined; |
{ | ||
"name": "react-scroll-sticky", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "react scroll sticky like 'side bar: about' in fb profile posts", | ||
@@ -5,0 +5,0 @@ "author": "", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
53474
12
515