react-bottom-scroll-listener
Advanced tools
Comparing version 4.0.0 to 4.1.0-beta0
@@ -12,5 +12,6 @@ /// <reference types="lodash" /> | ||
* @param debounceOptions Options passed to lodash.debounce, see https://lodash.com/docs/4.17.15#debounce | ||
* @param triggerOnNoScroll Triggers the onBottom callback when the page has no scrollbar | ||
* @return React.MutableRefObject Optionally you can use this to pass to a element to use that as the scroll container | ||
*/ | ||
declare function useBottomScrollListener<T extends HTMLElement>(onBottom: () => void, offset?: number, debounce?: number, debounceOptions?: DebounceOptions): import("react").RefObject<T>; | ||
declare function useBottomScrollListener<T extends HTMLElement>(onBottom: () => void, offset?: number, debounce?: number, debounceOptions?: DebounceOptions, triggerOnNoScroll?: boolean): import("react").RefObject<T>; | ||
export default useBottomScrollListener; |
@@ -14,3 +14,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
function useBottomScrollListener(onBottom, offset, debounce, debounceOptions) { | ||
function useBottomScrollListener(onBottom, offset, debounce, debounceOptions, triggerOnNoScroll) { | ||
if (offset === void 0) { | ||
@@ -30,2 +30,6 @@ offset = 0; | ||
if (triggerOnNoScroll === void 0) { | ||
triggerOnNoScroll = false; | ||
} | ||
var debouncedOnBottom = react.useMemo(function () { | ||
@@ -65,2 +69,6 @@ return createCallback(debounce, onBottom, debounceOptions); | ||
if (triggerOnNoScroll) { | ||
handleOnScroll(); | ||
} | ||
return function () { | ||
@@ -67,0 +75,0 @@ if (ref != null) { |
@@ -12,3 +12,3 @@ import { useMemo, useRef, useCallback, useEffect } from 'react'; | ||
function useBottomScrollListener(onBottom, offset, debounce, debounceOptions) { | ||
function useBottomScrollListener(onBottom, offset, debounce, debounceOptions, triggerOnNoScroll) { | ||
if (offset === void 0) { | ||
@@ -28,2 +28,6 @@ offset = 0; | ||
if (triggerOnNoScroll === void 0) { | ||
triggerOnNoScroll = false; | ||
} | ||
var debouncedOnBottom = useMemo(function () { | ||
@@ -63,2 +67,6 @@ return createCallback(debounce, onBottom, debounceOptions); | ||
if (triggerOnNoScroll) { | ||
handleOnScroll(); | ||
} | ||
return function () { | ||
@@ -65,0 +73,0 @@ if (ref != null) { |
{ | ||
"name": "react-bottom-scroll-listener", | ||
"version": "4.0.0", | ||
"version": "4.1.0-beta0", | ||
"description": "A simple React component that lets you listen for when you have scrolled to the bottom.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/karl-run/react-bottom-scroll-listener", |
@@ -48,3 +48,3 @@ # react-bottom-scroll-listener  [](https://www.npmjs.com/package/react-bottom-scroll-listener) [](https://github.com/karl-run/react-bottom-scroll-listener) | ||
const containerRef = useBottomScrollListener(callback); | ||
const scrollRef = useBottomScrollListener(callback); | ||
@@ -51,0 +51,0 @@ <div ref={scrollRef}>Callback will be invoked when this container is scrolled to bottom.</div> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
87030
724
1
1
2