Skip to content

Commit c7ff12e

Browse files
committed
Modififed multi-dot markers to make key property optional.
1 parent e5b5e69 commit c7ff12e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Multi-Dot marking
134134
<img height=50 src="https://github.com/wix-private/wix-react-native-calendar/blob/master/demo/marking4.png?raw=true">
135135
</kbd>
136136

137-
Use markingType = 'multi-dot' if you want to display more than one dot. Both the Calendar and CalendarList control support multiple dots by using 'dots' array in markedDates. The properties 'key' and 'color' are mandatory while 'selectedColor' is optional. If selectedColor is omitted then 'color' will be used for selected dates.
137+
Use markingType = 'multi-dot' if you want to display more than one dot. Both the Calendar and CalendarList control support multiple dots by using 'dots' array in markedDates. The property 'color' is mandatory while 'key' and 'selectedColor' are optional. If key is omitted then the array index is used as key. If selectedColor is omitted then 'color' will be used for selected dates.
138138
```javascript
139139
const vacation = {key:'vacation', color: 'red', selectedColor: 'blue'};
140140
const massage = {key:'massage', color: 'blue', selectedColor: 'blue'};

src/calendar/day/multi-dot/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ class Day extends Component {
6363
if (marking.dots && Array.isArray(marking.dots) && marking.dots.length > 0) {
6464
// Filter out dots so that we we process only those items which have key and color property
6565
const validDots = marking.dots.filter(d => (d && d.key && d.color));
66-
return validDots.map(dot => {
66+
return validDots.map((dot, index) => {
6767
return (
68-
<View key={dot.key} style={[baseDotStyle,
68+
<View key={dot.key ? dot.key : index} style={[baseDotStyle,
6969
{ backgroundColor: marking.selected && dot.selectedDotColor ? dot.selectedDotColor : dot.color}]}/>
7070
);
7171
});

0 commit comments

Comments
 (0)