Skip to content

Commit cd2a67e

Browse files
committed
Release version 1.1313.0
2 parents a175387 + 32a5eed commit cd2a67e

File tree

6 files changed

+123
-14
lines changed

6 files changed

+123
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default App;
204204
dayTextColor: '#2d4150',
205205
textDisabledColor: '#dd99ee'
206206
}}
207-
</Calendar>
207+
/>
208208
```
209209

210210
## Customized Calendar Examples

example/src/screens/playgroundScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function PlaygroundScreen() {
5454
);
5555
};
5656

57-
const renderExpendableCalendar = () => {
57+
const renderExpandableCalendar = () => {
5858
return (
5959
<CalendarProvider date={INITIAL_DATE}>
6060
<ExpandableCalendar
@@ -76,7 +76,7 @@ export default function PlaygroundScreen() {
7676
case elements.LIST:
7777
return renderCalendarList();
7878
case elements.EXPANDABLE:
79-
return renderExpendableCalendar();
79+
return renderExpandableCalendar();
8080
default:
8181
return renderCalendar();
8282
}

src/expandableCalendar/WeekCalendar/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const WeekCalendar = (props: WeekCalendarProps) => {
133133
);
134134
},[firstDay, _onDayPress, context, date, markedDates]);
135135

136-
const keyExtractor = useCallback((item) => item, []);
136+
const keyExtractor = useCallback((item, index) => `${item}-${index}`, []);
137137

138138
const renderWeekDaysNames = useMemo(() => {
139139
return (

src/expandableCalendar/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,24 @@ const ExpandableCalendar = forwardRef<ExpandableCalendarRef, ExpandableCalendarP
191191

192192
const [position, setPosition] = useState(numberOfDays ? Positions.CLOSED : initialPosition);
193193
const isOpen = position === Positions.OPEN;
194-
const getOpenHeight = () => {
194+
const getOpenHeight = useCallback(() => {
195195
if (!horizontal) {
196196
return Math.max(constants.screenHeight, constants.screenWidth);
197197
}
198198
return headerHeight + (WEEK_HEIGHT * (numberOfWeeks.current)) + (hideKnob ? 0 : KNOB_CONTAINER_HEIGHT);
199-
};
199+
}, [headerHeight, horizontal, hideKnob, numberOfWeeks]);
200+
200201
const openHeight = useRef(getOpenHeight());
201202
const closedHeight = useMemo(() => headerHeight + WEEK_HEIGHT + (hideKnob || Number(numberOfDays) > 1 ? 0 : KNOB_CONTAINER_HEIGHT), [numberOfDays, hideKnob, headerHeight]);
202-
const startHeight = useMemo(() => isOpen ? openHeight.current : closedHeight, [closedHeight, isOpen]);
203+
const startHeight = useMemo(() => isOpen ? getOpenHeight() : closedHeight, [closedHeight, isOpen, getOpenHeight]);
203204
const _height = useRef(startHeight);
204205
const deltaY = useMemo(() => new Animated.Value(startHeight), [startHeight]);
205206
const headerDeltaY = useRef(new Animated.Value(isOpen ? -headerHeight : 0));
206207

207208
useEffect(() => {
208209
_height.current = startHeight;
209210
deltaY.setValue(startHeight);
211+
_wrapperStyles.current.style.height = startHeight;
210212
}, [startHeight]);
211213

212214
useEffect(() => {
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)