UNPKG

react-infinite-scroll-smart

Version:

Infinite scroll component for list and reverse list, feed and chats

9 lines (8 loc) 671 B
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import useInfiniteScroll from "../hooks/useInfiniteScroll"; const InfiniteScroll = (props) => { const { callback, children, className, disabled = false, useWindowScroll = false, direction = "bottom", style = {}, rootMargin = "100px", } = props; const { sentinelRef, parentRef, containerStyles } = useInfiniteScroll(callback, direction, useWindowScroll, disabled, rootMargin); return (_jsxs("div", { ref: parentRef, className: className, style: { ...containerStyles, ...style }, children: [children, _jsx("div", { ref: sentinelRef, style: { height: 1 } })] })); }; export default InfiniteScroll;