Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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}
inverted={false}
/>
);
};
Expand Down
6 changes: 6 additions & 0 deletions src/calendar-list/calendarList.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
"type": "boolean",
"description": "Whether to enable or disable vertical / horizontal scroll indicator",
"default": "false"
},
{
"name": "inverted",
"type": "boolean",
"description": "Whether to invert the calendar",
"default": "false"
}
]
}
7 changes: 5 additions & 2 deletions src/calendar-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ export interface CalendarListProps extends CalendarProps, Omit<FlatListProps<any
showScrollIndicator?: boolean;
/** Whether to animate the auto month scroll */
animateScroll?: boolean;
/** Whether to invert the calendar */
inverted?: boolean;
}

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

const staticHeaderStyle = useMemo(() => {
return [style.current.staticHeader, headerStyle];
Expand Down