Skip to content

Commit 71f8ead

Browse files
committed
Fix issue in infinite list when not passing reloadPages
1 parent 1c92d56 commit 71f8ead

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/infinite-list/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {ScrollViewProps} from 'react-native';
44
import {DataProvider, LayoutProvider, RecyclerListView, RecyclerListViewProps} from 'recyclerlistview';
55
import inRange from 'lodash/inRange';
66
import debounce from 'lodash/debounce';
7+
import noop from 'lodash/noop';
78

89
import constants from '../commons/constants';
910
import useCombinedRefs from '../commons/useCombinedRefs';
@@ -29,7 +30,7 @@ const InfiniteList = (props: InfiniteListProps, ref: any) => {
2930
const {
3031
renderItem,
3132
data,
32-
reloadPages,
33+
reloadPages = noop,
3334
pageWidth = constants.screenWidth,
3435
pageHeight = constants.screenHeight,
3536
onPageChange,
@@ -59,8 +60,6 @@ const InfiniteList = (props: InfiniteListProps, ref: any) => {
5960
const isOnEdge = useRef(false);
6061
const isNearEdge = useRef(false);
6162
const scrolledByUser = useRef(false);
62-
63-
// @ts-expect-error lodash can't handle reloadPages signature
6463
const reloadPagesDebounce = useCallback(debounce(reloadPages, 500, {leading: false, trailing: true}), [reloadPages]);
6564

6665
useEffect(() => {

0 commit comments

Comments
 (0)