Skip to content

Commit 6dd0ed9

Browse files
authored
Timeline - fix api file and add one for TimelineList (#2668)
1 parent 3a61838 commit 6dd0ed9

File tree

2 files changed

+114
-7
lines changed

2 files changed

+114
-7
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "TimelineList",
3+
"description": "TimelineList component",
4+
"images": [
5+
"https://github.com/wix/react-native-calendars/blob/master/demo/assets/timeline-calendar.gif?raw=true"
6+
],
7+
"extends": ["InfiniteList"],
8+
"extendsLink": ["https://github.com/wix/react-native-calendars/blob/1.1311.1/src/infinite-list/index.tsx"],
9+
"example": "https://github.com/wix/react-native-calendars/blob/1.1311.1/example/src/screens/timelineCalendarScreen.tsx",
10+
"props": [
11+
{
12+
"name": "events",
13+
"type": "{[date: string]: TimelineProps['events']}",
14+
"description": "Map of all timeline events ({[date]: events})"
15+
},
16+
{
17+
"name": "timelineProps",
18+
"type": "Omit<TimelineProps, 'events' | 'scrollToFirst' | 'showNowIndicator' | 'scrollToNow' | 'initialTime'>",
19+
"description": "General timeline props to pass to each timeline item"
20+
},
21+
{
22+
"name": "renderItem",
23+
"type": "(timelineProps: TimelineProps, info: TimelineListRenderItemInfo) => JSX.Element",
24+
"description": "Pass to render a custom Timeline item"
25+
},
26+
{
27+
"name": "scrollToFirst",
28+
"type": "boolean",
29+
"description": "Should scroll to first event of the day"
30+
},
31+
{
32+
"name": "showNowIndicator",
33+
"type": "boolean",
34+
"description": "Should show now indicator (shown only on 'today' timeline)"
35+
},
36+
{
37+
"name": "scrollToNow",
38+
"type": "boolean",
39+
"description": "Should initially scroll to current time (relevant only for 'today' timeline)"
40+
},
41+
{
42+
"name": "initialTime",
43+
"type": "TimelineProps['initialTime']",
44+
"description": "Should initially scroll to a specific time (relevant only for NOT 'today' timelines)"
45+
}
46+
]
47+
}

src/timeline/timeline.api.json

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
],
77
"extends": ["ScrollView"],
88
"extendsLink": ["https://reactnative.dev/docs/scrollview"],
9-
"example": "https://github.com/wix/react-native-calendars/blob/master/example/src/screens/timelineCalendar.tsx",
9+
"example": "https://github.com/wix/react-native-calendars/blob/master/example/src/screens/timelineCalendarScreen.tsx",
1010
"props": [
1111
{
12-
"name": "theme",
13-
"type": "Theme",
14-
"description": "Specify theme properties to override specific styles for calendar parts"
12+
"name": "date",
13+
"type": "string | string[]",
14+
"description": "The date / dates of this timeline instance in ISO format (e.g. 2011-10-25)"
1515
},
1616
{
1717
"name": "events",
@@ -46,21 +46,54 @@
4646
"description": "Handler which gets executed when background's long pressed released. Pass to handle creation of a new event"
4747
},
4848
{
49-
"name": "renderEvent",
50-
"type": "(event: PackedEvent) => JSX.Element",
51-
"description": "Specify a custom event block"
49+
"name": "theme",
50+
"type": "Theme",
51+
"description": "Specify theme properties to override specific styles for calendar parts"
5252
},
5353
{
5454
"name": "scrollToFirst",
5555
"type": "boolean",
5656
"description": "Whether to scroll to the first event"
5757
},
58+
{
59+
"name": "scrollToNow",
60+
"type": "boolean",
61+
"description": "Whether to scroll to the current time on first render",
62+
"default": "false"
63+
},
64+
{
65+
"name": "initialTime",
66+
"type": "NewEventTime",
67+
"description": "The initial time to scroll to when the timeline is first rendered",
68+
"default": "{ hour: 0, minute: 0 }"
69+
},
5870
{
5971
"name": "format24h",
6072
"type": "boolean",
6173
"description": "Whether to use 24 hours format for the timeline hours",
6274
"default": "true"
6375
},
76+
{
77+
"name": "renderEvent",
78+
"type": "(event: PackedEvent) => JSX.Element",
79+
"description": "Specify a custom event block"
80+
},
81+
{
82+
"name": "showNowIndicator",
83+
"type": "boolean",
84+
"description": "Whether to show the now indicator",
85+
"default": "false"
86+
},
87+
{
88+
"name": "scrollOffset",
89+
"type": "number",
90+
"description": "A scroll offset value that the timeline will sync with"
91+
},
92+
{
93+
"name": "onChangeOffset",
94+
"type": "(offset: number) => void",
95+
"description": "Listen to onScroll event of the timeline component"
96+
},
6497
{
6598
"name": "overlapEventsSpacing",
6699
"type": "number",
@@ -72,6 +105,33 @@
72105
"type": "number",
73106
"description": "Spacing to keep at the right edge (for background press)",
74107
"default": "10"
108+
},
109+
{
110+
"name": "unavailableHours",
111+
"type": "UnavailableHours[]",
112+
"description": "Range of available hours"
113+
},
114+
{
115+
"name": "unavailableHoursColor",
116+
"type": "string",
117+
"description": "Background color for unavailable hours"
118+
},
119+
{
120+
"name": "numberOfDays",
121+
"type": "number",
122+
"description": "The number of days to present in the timeline calendar",
123+
"default": "1"
124+
},
125+
{
126+
"name": "timelineLeftInset",
127+
"type": "number",
128+
"description": "The left inset of the timeline calendar (sidebar width)",
129+
"default": "72"
130+
},
131+
{
132+
"name": "testID",
133+
"type": "string",
134+
"description": "Identifier for testing"
75135
}
76136
]
77137
}

0 commit comments

Comments
 (0)