File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11import { useEffect } from 'react' ;
22import {
33 useTrackVisibility ,
4+ IntersectionObserverHookArgs ,
45 IntersectionObserverHookRefCallback ,
56 IntersectionObserverHookRootRefCallback ,
67} from 'react-intersection-observer-hook' ;
@@ -12,21 +13,23 @@ export type UseInfiniteScrollHookResult = [
1213 { rootRef : IntersectionObserverHookRootRefCallback } ,
1314] ;
1415
15- export interface UseInfiniteScrollHookArgs {
16+ export type UseInfiniteScrollHookArgs = Pick <
17+ IntersectionObserverHookArgs ,
18+ // We pass this to 'IntersectionObserver'. We can use it to configure when to trigger 'onLoadMore'.
19+ 'rootMargin'
20+ > & {
1621 // Some sort of "is fetching" info of the request.
1722 loading : boolean ;
1823 // If the list has more items to load.
1924 hasNextPage : boolean ;
2025 // The callback function to execute when the 'onLoadMore' is triggered.
2126 // eslint-disable-next-line no-undef
2227 onLoadMore : VoidFunction ;
23- // We pass this to 'IntersectionObserver'. We can use it to configure when to trigger 'onLoadMore'.
24- rootMargin ?: string ;
2528 // Flag to stop infinite scrolling. Can be used in case of an error etc too.
2629 disabled ?: boolean ;
2730 // How long it should wait before triggering 'onLoadMore'.
2831 delayInMs ?: number ;
29- }
32+ } ;
3033
3134function useInfiniteScroll ( {
3235 loading,
You can’t perform that action at this time.
0 commit comments