Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/src/screens/calendarListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const CalendarListScreen = (props: Props) => {
horizontal={horizontalView}
pagingEnabled={horizontalView}
staticHeader={horizontalView}
descendingOrder={false}
/>
);
};
Expand Down
5 changes: 4 additions & 1 deletion src/calendar-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface CalendarListProps extends CalendarProps, Omit<FlatListProps<any
showScrollIndicator?: boolean;
/** Whether to animate the auto month scroll */
animateScroll?: boolean;
/** Whether to load the calendar list items in descending order (most recent month at the top) */
descendingOrder?: boolean;
}

export interface CalendarListImperativeMethods {
Expand Down Expand Up @@ -78,6 +80,7 @@ const CalendarList = (props: CalendarListProps & ContextProp, ref: any) => {
calendarWidth = CALENDAR_WIDTH,
calendarStyle,
animateScroll = false,
descendingOrder = false,
showScrollIndicator = false,
staticHeader,
/** View props */
Expand Down Expand Up @@ -120,7 +123,7 @@ const CalendarList = (props: CalendarListProps & ContextProp, ref: any) => {
const rangeDate = initialDate.current?.clone().addMonths(i - pastScrollRange, true);
months.push(rangeDate);
}
return months;
return descendingOrder ? months.reverse() : months;
}, [pastScrollRange, futureScrollRange]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}, [descendingOrder, pastScrollRange, futureScrollRange]);


const staticHeaderStyle = useMemo(() => {
Expand Down