File size: 775 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
// @flow
import React from 'react';
import InfiniteScroll from 'react-infinite-scroller-fork-mxstbr';
import { useAppScroller } from 'src/hooks/useAppScroller';
type Props = {
loadMore: Function,
hasMore: boolean,
loader: React$Node,
isReverse?: boolean,
};
/*
Because route modals (like the thread modal) share the same scroll container
as all other views, we want to make sure that if a modal is open that we
aren't performing unnecessary pagination in the background
*/
const InfiniteScroller = (props: Props) => {
const { ref } = useAppScroller();
return (
<InfiniteScroll
useWindow={false}
initialLoad={false}
threshold={750}
getScrollParent={() => ref}
{...props}
/>
);
};
export default InfiniteScroller;
|