Overview
TheTimelineList component is a horizontally scrollable paging list that displays timeline views for multiple days. It must be wrapped with CalendarProvider and automatically synchronizes with the selected date in the calendar context. This component is ideal for creating week or multi-day timeline views.
The
TimelineList component must be wrapped with CalendarProvider to function correctly.Basic usage
Complete example
Props
Map of all timeline events organized by date. Each key should be a date string (YYYY-MM-DD format) and the value should be an array of timeline events.Each event should have:
start(string): Start time in ‘YYYY-MM-DD HH:mm:ss’ formatend(string): End time in ‘YYYY-MM-DD HH:mm:ss’ formattitle(string): Event titlecolor(string): Event color
timelineProps
Omit<TimelineProps, 'events' | 'scrollToFirst' | 'showNowIndicator' | 'scrollToNow' | 'initialTime'>
General timeline props to pass to each timeline item. These props are applied to all timeline pages.Common properties:See Timeline component for all available props.
format24h(boolean): Use 24-hour formatstart(number): Start hour (0-23)end(number): End hour (0-23)unavailableHours(Array): Hours to mark as unavailableoverlapEventsSpacing(number): Spacing between overlapping eventsrightEdgeSpacing(number): Right edge spacing
Pass to render a custom Timeline item. This allows you to wrap or customize each timeline page.The
info object contains:item(string): The date string for this pageindex(number): The page indexisCurrent(boolean): Whether this is the currently selected dateisInitialPage(boolean): Whether this is the initial pageisToday(boolean): Whether this date is today
Should scroll to the first event of the day when the page loads.
This prop is only applied to the initial page and only for dates that are NOT today.
Should show the now indicator line. The indicator is shown only on today’s timeline.
Should initially scroll to the current time. This is only relevant for today’s timeline on the initial page.
This prop only applies to the current day’s timeline when it’s the initial page.
Should initially scroll to a specific time. This is only relevant for timelines that are NOT today and only on the initial page.
How it works
-
Horizontal Paging: The component creates a horizontal scrollable list of timeline pages. Each page represents one or more days (controlled by
numberOfDaysin CalendarProvider). - Date Synchronization: When you scroll between pages, the component automatically updates the selected date in the CalendarProvider context.
- Infinite Scrolling: The component uses an InfiniteList internally to provide smooth scrolling and automatic page management. When you reach near the edge of the available pages, new pages are generated automatically.
-
Multi-day Support: When
numberOfDaysis set in CalendarProvider (e.g.,numberOfDays={3}), each page displays multiple days side-by-side.
Usage with CalendarProvider
TheTimelineList component works closely with CalendarProvider and respects the following context properties:
Performance considerations
The TimelineList component uses InfiniteList internally for optimal performance with large datasets and infinite scrolling.
- Pages are rendered on demand as you scroll
- Automatic page recycling when scrolling far from the initial position
- Smooth synchronization with calendar date changes
- Optimized for both iOS and Android, including RTL support
Notes
Event times must be in the format ‘YYYY-MM-DD HH:mm:ss’ for proper rendering.
The component automatically handles RTL (right-to-left) layouts on Android and React Native 0.73+.
Related components
- CalendarProvider - Required wrapper for TimelineList
- Timeline - The individual timeline component rendered for each day
- ExpandableCalendar - Often used together with TimelineList