Skip to content

Commit

Permalink
Enhance infiniteAgendaList (#2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakirza17 authored Jul 12, 2023
1 parent ad6f5dc commit ffdee18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/expandableCalendar/agendaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export interface AgendaListProps extends SectionListProps<any, DefaultSectionT>
infiniteListProps?: {
itemHeight?: number;
titleHeight?: number;
visibleIndicesChangedDebounce?: number;
renderFooter?: () => React.ReactElement | null;
};
}

Expand Down
5 changes: 3 additions & 2 deletions src/expandableCalendar/infiniteAgendaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const InfiniteAgendaList = (props: AgendaListProps) => {
}
}
}
}, 1000, {leading: false, trailing: true},), [avoidDateUpdates, setDate, data]);
}, infiniteListProps?.visibleIndicesChangedDebounce ?? 1000, {leading: false, trailing: true},), [avoidDateUpdates, setDate, data]);

const findItemTitleIndex = useCallback((itemIndex: number) => {
let titleIndex = itemIndex;
Expand Down Expand Up @@ -236,10 +236,11 @@ const InfiniteAgendaList = (props: AgendaListProps) => {
layoutProvider={layoutProvider}
onScroll={_onScroll}
onVisibleIndicesChanged={_onVisibleIndicesChanged}
scrollViewProps={{onMomentumScrollEnd: _onMomentumScrollEnd}}
scrollViewProps={{onMomentumScrollEnd: _onMomentumScrollEnd, nestedScrollEnabled: true}}
onEndReached={_onEndReached}
onEndReachedThreshold={onEndReachedThreshold as number | undefined}
disableScrollOnDataChange
renderFooter={infiniteListProps?.renderFooter}
/>
);
};
Expand Down
3 changes: 3 additions & 0 deletions src/infinite-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface InfiniteListProps
positionIndex?: number;
layoutProvider?: LayoutProvider;
disableScrollOnDataChange?: boolean;
renderFooter?: () => React.ReactElement | null;
}

const InfiniteList = (props: InfiniteListProps, ref: any) => {
Expand All @@ -51,6 +52,7 @@ const InfiniteList = (props: InfiniteListProps, ref: any) => {
layoutProvider,
onScroll,
onEndReached,
renderFooter,
} = props;

const dataProvider = useMemo(() => {
Expand Down Expand Up @@ -179,6 +181,7 @@ const InfiniteList = (props: InfiniteListProps, ref: any) => {
onEndReached={onEndReached}
onEndReachedThreshold={onEndReachedThreshold}
onVisibleIndicesChanged={onVisibleIndicesChanged}
renderFooter={renderFooter}
/>
);
};
Expand Down

0 comments on commit ffdee18

Please sign in to comment.