@momo-kits/calendar 0.121.0-rc.3 → 0.121.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CalendarPro.tsx +251 -340
- package/Day.tsx +113 -193
- package/LunarDateConverter.ts +14 -0
- package/Month.tsx +96 -93
- package/MonthList.tsx +199 -262
- package/TabHeader.tsx +3 -3
- package/Util.ts +27 -32
- package/index.tsx +266 -383
- package/package.json +1 -1
- package/types.ts +7 -6
package/CalendarPro.tsx
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, {
|
|
2
|
+
useContext,
|
|
3
|
+
useRef,
|
|
4
|
+
useState,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
forwardRef,
|
|
8
|
+
useImperativeHandle,
|
|
9
|
+
} from 'react';
|
|
3
10
|
import {ScrollView, View} from 'react-native';
|
|
4
|
-
import Moment from 'moment';
|
|
11
|
+
import moment, {Moment} from 'moment';
|
|
5
12
|
import {
|
|
6
13
|
ApplicationContext,
|
|
7
14
|
CheckBox,
|
|
@@ -15,377 +22,281 @@ import LunarDateConverter from './LunarDateConverter';
|
|
|
15
22
|
import Util from './Util';
|
|
16
23
|
import {
|
|
17
24
|
CalendarProProps,
|
|
18
|
-
|
|
25
|
+
CalendarProRef,
|
|
19
26
|
HeaderControlRef,
|
|
27
|
+
MonthListRef,
|
|
20
28
|
Holidays,
|
|
21
29
|
} from './types';
|
|
22
30
|
import {ContainerContext} from './index';
|
|
23
31
|
import styles from './styles';
|
|
24
32
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
const CalendarPro = forwardRef<CalendarProRef, CalendarProProps>(
|
|
34
|
+
(
|
|
35
|
+
{
|
|
36
|
+
startDate: propStartDate,
|
|
37
|
+
endDate: propEndDate,
|
|
38
|
+
minDate: propMinDate,
|
|
39
|
+
maxDate: propMaxDate,
|
|
40
|
+
isShowLunar: propIsShowLunar,
|
|
41
|
+
selectedDate: propSelectedDate,
|
|
42
|
+
isDoubleDateMode,
|
|
43
|
+
onDateChange,
|
|
44
|
+
priceList,
|
|
45
|
+
isHideHoliday,
|
|
46
|
+
isOffLunar,
|
|
47
|
+
onCallbackCalendar,
|
|
48
|
+
disabledDays,
|
|
49
|
+
},
|
|
50
|
+
ref
|
|
51
|
+
) => {
|
|
52
|
+
const {theme, translate} = useContext(ApplicationContext);
|
|
53
|
+
const size = useContext(ContainerContext);
|
|
39
54
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.getDateRange();
|
|
45
|
-
this.header = this.today.clone();
|
|
46
|
-
this.selectedDate = props.selectedDate;
|
|
47
|
-
this.headerControlRef = createRef<HeaderControlRef>();
|
|
48
|
-
this.state = {
|
|
49
|
-
startDate: props.startDate,
|
|
50
|
-
endDate: props.endDate,
|
|
51
|
-
showLunar: props.isShowLunar,
|
|
52
|
-
tabSelected: 0,
|
|
53
|
-
holidays: [],
|
|
54
|
-
ownUpdate: false,
|
|
55
|
-
};
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
this.converter = new LunarDateConverter();
|
|
58
|
-
}
|
|
55
|
+
const today = useMemo(() => moment(), []);
|
|
56
|
+
const headerRef = useRef<Moment>(today.clone());
|
|
57
|
+
const headerControlRef = useRef<HeaderControlRef>(null);
|
|
58
|
+
const monthListRef = useRef<MonthListRef>(null);
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
// Compute min/max date range
|
|
61
|
+
const [minDate, maxDate] = useMemo(() => {
|
|
62
|
+
let max = moment(propMaxDate);
|
|
63
|
+
let min = moment(propMinDate);
|
|
64
|
+
const maxValid = max.isValid();
|
|
65
|
+
const minValid = min.isValid();
|
|
66
|
+
if (!maxValid && !minValid) {
|
|
67
|
+
max = moment().add(12, 'months');
|
|
68
|
+
min = moment();
|
|
69
|
+
} else if (!maxValid && minValid) {
|
|
70
|
+
max = min.clone().add(12, 'months');
|
|
71
|
+
} else if (maxValid && !minValid) {
|
|
72
|
+
min = max.clone().subtract(12, 'months');
|
|
73
|
+
}
|
|
74
|
+
return [min, max];
|
|
75
|
+
}, [propMinDate, propMaxDate, isDoubleDateMode]);
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const dateScroll = isScrollToStartDate
|
|
87
|
-
? dateRange.startDate
|
|
88
|
-
: dateRange.endDate;
|
|
77
|
+
// State
|
|
78
|
+
const [startDate, setStartDate] = useState<Moment>(propStartDate);
|
|
79
|
+
const [endDate, setEndDate] = useState<Moment | null>(propEndDate || null);
|
|
80
|
+
const [showLunar, setShowLunar] = useState<boolean>(!!propIsShowLunar);
|
|
81
|
+
const [tabSelected, setTabSelected] = useState<number>(0);
|
|
82
|
+
const [holidays, setHolidays] = useState<Holidays[]>([]);
|
|
83
|
+
const [temp, setTemp] = useState<any[]>([]);
|
|
84
|
+
const [headerKey, setHeaderKey] = useState<string>('');
|
|
85
|
+
const [ownUpdate, setOwnUpdate] = useState<boolean>(false);
|
|
86
|
+
|
|
87
|
+
const converter: any = useMemo(() => LunarDateConverter(), []);
|
|
89
88
|
|
|
90
|
-
|
|
89
|
+
useImperativeHandle(ref, () => ({
|
|
90
|
+
setDoubleDateAndTabIndex: (
|
|
91
|
+
firstDate?: Moment | null,
|
|
92
|
+
secondDate?: Moment | null,
|
|
93
|
+
tabIdx?: number
|
|
94
|
+
) => {
|
|
95
|
+
if (typeof tabIdx === 'number') setTabSelected(tabIdx);
|
|
96
|
+
if (firstDate) setStartDate(firstDate);
|
|
97
|
+
if (secondDate !== undefined) setEndDate(secondDate);
|
|
98
|
+
},
|
|
99
|
+
setDateRange: (
|
|
100
|
+
dateRange: {startDate: any; endDate: any},
|
|
101
|
+
) => {
|
|
102
|
+
if (monthListRef.current && dateRange.startDate) {
|
|
103
|
+
monthListRef.current.scrollToMonth(moment(dateRange.startDate));
|
|
91
104
|
}
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
};
|
|
105
|
+
},
|
|
106
|
+
}));
|
|
95
107
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
108
|
+
// Sync showLunar prop
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (ownUpdate) {
|
|
111
|
+
setOwnUpdate(false);
|
|
112
|
+
} else if (propIsShowLunar !== showLunar) {
|
|
113
|
+
setShowLunar(!!propIsShowLunar);
|
|
114
|
+
}
|
|
115
|
+
}, [propIsShowLunar]);
|
|
102
116
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
max = Moment().add(12, 'months');
|
|
111
|
-
min = Moment();
|
|
112
|
-
}
|
|
113
|
-
if (!maxValid && minValid) {
|
|
114
|
-
max = min.add(12, 'months');
|
|
115
|
-
}
|
|
116
|
-
if (maxValid && !minValid) {
|
|
117
|
-
min = max.subtract(12, 'months');
|
|
118
|
-
}
|
|
119
|
-
if (min.isSame(max) && this.props.isDoubleDateMode) return {};
|
|
120
|
-
if (min.isAfter(max)) return {};
|
|
121
|
-
this.minDate = min;
|
|
122
|
-
this.maxDate = max;
|
|
123
|
-
};
|
|
117
|
+
// Scroll to initial selected date on mount or when it changes
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
const timer = setTimeout(() => {
|
|
120
|
+
monthListRef.current?.scrollToMonth(propSelectedDate);
|
|
121
|
+
}, 500);
|
|
122
|
+
return () => clearTimeout(timer);
|
|
123
|
+
}, [propSelectedDate]);
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
endDate: null,
|
|
138
|
-
});
|
|
125
|
+
// Handlers
|
|
126
|
+
const onChooseDay = (day: Moment) => {
|
|
127
|
+
if (isDoubleDateMode) {
|
|
128
|
+
if (tabSelected === 1) {
|
|
129
|
+
if (startDate && day >= startDate) {
|
|
130
|
+
setEndDate(day);
|
|
131
|
+
} else if (startDate && day < startDate) {
|
|
132
|
+
setStartDate(day);
|
|
133
|
+
setEndDate(null);
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
setStartDate(day);
|
|
139
137
|
}
|
|
140
138
|
} else {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
139
|
+
setStartDate(day);
|
|
140
|
+
setEndDate(null);
|
|
144
141
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
startDate: day,
|
|
148
|
-
endDate: null,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (onDateChange) {
|
|
152
|
-
onDateChange(day);
|
|
153
|
-
}
|
|
154
|
-
};
|
|
142
|
+
onDateChange?.(day);
|
|
143
|
+
};
|
|
155
144
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
Util.getHolidaysInMonth(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
} else {
|
|
169
|
-
data = holidays;
|
|
170
|
-
}
|
|
171
|
-
this.ownSetState({
|
|
172
|
-
holidays,
|
|
173
|
-
temp: data,
|
|
174
|
-
headerKey: key,
|
|
175
|
-
});
|
|
176
|
-
};
|
|
145
|
+
const executeProcessAfterScrollCalendar = (date: Moment, key: string) => {
|
|
146
|
+
// get sorted array of holidays directly
|
|
147
|
+
const allHolidays = Util.getHolidaysInMonth(moment(date));
|
|
148
|
+
const filtered = showLunar
|
|
149
|
+
? allHolidays
|
|
150
|
+
: allHolidays.filter(item => !item.lunar || item.mixedLabel);
|
|
151
|
+
headerControlRef.current?.onUpdateInfo({date});
|
|
152
|
+
headerRef.current = date.clone().startOf('month');
|
|
153
|
+
setHolidays(allHolidays);
|
|
154
|
+
setTemp(filtered);
|
|
155
|
+
setHeaderKey(key);
|
|
156
|
+
};
|
|
177
157
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
158
|
+
const onScrollCalendar = (info: {
|
|
159
|
+
date: Moment;
|
|
160
|
+
key: string;
|
|
161
|
+
currentIndex: number;
|
|
162
|
+
}) => {
|
|
163
|
+
if (info.key !== headerKey) {
|
|
164
|
+
executeProcessAfterScrollCalendar(info.date, info.key);
|
|
183
165
|
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
setDoubleDateAndTabIndex = (
|
|
188
|
-
firstDate: Moment.Moment | Date | undefined,
|
|
189
|
-
secondDate?: Moment.Moment | Date | undefined | null,
|
|
190
|
-
tabSelected?: any
|
|
191
|
-
) => {
|
|
192
|
-
this.ownSetState({
|
|
193
|
-
startDate: firstDate ? Moment(firstDate) : null,
|
|
194
|
-
endDate: secondDate ? Moment(secondDate) : null,
|
|
195
|
-
tabSelected,
|
|
196
|
-
});
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
toggleLunarDate = () => {
|
|
200
|
-
const {showLunar, holidays} = this.state;
|
|
201
|
-
const {onCallbackCalendar} = this.props;
|
|
202
|
-
let data: Holidays[] = [];
|
|
203
|
-
const nextStateShowLunar = !showLunar;
|
|
204
|
-
if (!nextStateShowLunar) {
|
|
205
|
-
data = holidays?.filter(item => !item.lunar || item.mixedLabel);
|
|
206
|
-
} else {
|
|
207
|
-
data = holidays;
|
|
208
|
-
}
|
|
209
|
-
if (onCallbackCalendar) {
|
|
210
|
-
onCallbackCalendar('lunar', nextStateShowLunar);
|
|
211
|
-
}
|
|
166
|
+
};
|
|
212
167
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
168
|
+
const onToggleLunar = () => {
|
|
169
|
+
setOwnUpdate(true);
|
|
170
|
+
const next = !showLunar;
|
|
171
|
+
const filtered = next
|
|
172
|
+
? holidays
|
|
173
|
+
: holidays.filter(item => !item.lunar || item.mixedLabel);
|
|
174
|
+
onCallbackCalendar?.('lunar', next);
|
|
175
|
+
setShowLunar(next);
|
|
176
|
+
setTemp(filtered);
|
|
177
|
+
};
|
|
219
178
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
};
|
|
179
|
+
const onPressBackArrow = () => {
|
|
180
|
+
const prev = headerRef.current
|
|
181
|
+
.clone()
|
|
182
|
+
.startOf('month')
|
|
183
|
+
.subtract(1, 'months');
|
|
184
|
+
if (prev.isSameOrAfter(minDate, 'month')) {
|
|
185
|
+
headerRef.current = prev;
|
|
186
|
+
headerControlRef.current?.onUpdateInfo({date: prev});
|
|
187
|
+
monthListRef.current?.scrollToMonth(prev);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
233
190
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
this.monthListRef?.scrollToMonth(nextDate);
|
|
243
|
-
}
|
|
244
|
-
};
|
|
191
|
+
const onPressNextArrow = () => {
|
|
192
|
+
const next = headerRef.current.clone().startOf('month').add(1, 'months');
|
|
193
|
+
if (next.isSameOrBefore(maxDate, 'month')) {
|
|
194
|
+
headerRef.current = next;
|
|
195
|
+
headerControlRef.current?.onUpdateInfo({date: next});
|
|
196
|
+
monthListRef.current?.scrollToMonth(next);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
245
199
|
|
|
246
|
-
|
|
247
|
-
const {
|
|
248
|
-
startDate,
|
|
249
|
-
endDate,
|
|
250
|
-
showLunar = false,
|
|
251
|
-
tabSelected,
|
|
252
|
-
holidays,
|
|
253
|
-
temp,
|
|
254
|
-
} = this.state;
|
|
255
|
-
const {
|
|
256
|
-
isDoubleDateMode,
|
|
257
|
-
priceList,
|
|
258
|
-
disabledDays,
|
|
259
|
-
isHideHoliday,
|
|
260
|
-
isOffLunar,
|
|
261
|
-
} = this.props;
|
|
200
|
+
// Determine price list format
|
|
262
201
|
let priceListFormat = priceList?.outbound;
|
|
263
202
|
if (isDoubleDateMode) {
|
|
264
203
|
priceListFormat =
|
|
265
204
|
tabSelected === 0 ? priceList?.outbound : priceList?.inbound;
|
|
266
205
|
}
|
|
267
206
|
|
|
268
|
-
const {theme, translate} = this.context;
|
|
269
|
-
|
|
270
207
|
return (
|
|
271
|
-
<
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
color={
|
|
287
|
-
item === 6 || item === 7
|
|
288
|
-
? Colors.red_03
|
|
289
|
-
: Colors.black_17
|
|
290
|
-
}
|
|
291
|
-
typography={'label_s_medium'}
|
|
292
|
-
style={[
|
|
293
|
-
styles.textDay,
|
|
294
|
-
{
|
|
295
|
-
width: (size.width - Spacing.M * 2) / 7,
|
|
296
|
-
},
|
|
297
|
-
]}
|
|
298
|
-
key={item}>
|
|
299
|
-
{translate(Util.mapWeeKDate(item))}
|
|
300
|
-
</Text>
|
|
301
|
-
))}
|
|
302
|
-
</View>
|
|
303
|
-
<MonthList
|
|
304
|
-
ref={ref => (this.monthListRef = ref)}
|
|
305
|
-
today={this.today}
|
|
306
|
-
minDate={this.minDate}
|
|
307
|
-
maxDate={this.maxDate}
|
|
308
|
-
startDate={startDate}
|
|
309
|
-
endDate={endDate}
|
|
310
|
-
onChoose={this.onChoose}
|
|
311
|
-
onScrollCalendar={this.onScrollCalendar}
|
|
312
|
-
isShowLunar={!isOffLunar && showLunar}
|
|
313
|
-
isDoubleDateMode={isDoubleDateMode}
|
|
314
|
-
tabSelected={tabSelected}
|
|
315
|
-
lunarConverter={this.converter}
|
|
316
|
-
holidays={holidays}
|
|
317
|
-
selectedDate={this.selectedDate}
|
|
318
|
-
priceList={priceListFormat}
|
|
319
|
-
disabledDays={disabledDays}
|
|
320
|
-
/>
|
|
321
|
-
</View>
|
|
322
|
-
</View>
|
|
323
|
-
{!isOffLunar && (
|
|
324
|
-
<View
|
|
208
|
+
<View style={styles.container}>
|
|
209
|
+
<HeaderControl
|
|
210
|
+
ref={headerControlRef}
|
|
211
|
+
selectedDate={propSelectedDate}
|
|
212
|
+
onPressBackArrow={onPressBackArrow}
|
|
213
|
+
onPressNextArrow={onPressNextArrow}
|
|
214
|
+
/>
|
|
215
|
+
<View style={styles.blueSeperator} />
|
|
216
|
+
<View>
|
|
217
|
+
<View style={styles.viewDay}>
|
|
218
|
+
{[1, 2, 3, 4, 5, 6, 7].map(dayIdx => (
|
|
219
|
+
<Text
|
|
220
|
+
key={dayIdx}
|
|
221
|
+
color={dayIdx >= 6 ? Colors.red_03 : Colors.black_17}
|
|
222
|
+
typography="label_s_medium"
|
|
325
223
|
style={[
|
|
326
|
-
styles.
|
|
327
|
-
{
|
|
224
|
+
styles.textDay,
|
|
225
|
+
{width: (size.width - Spacing.M * 2) / 7},
|
|
328
226
|
]}>
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
{
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
: '';
|
|
364
|
-
return (
|
|
365
|
-
<View style={styles.row} key={idx.toString()}>
|
|
366
|
-
<Text
|
|
367
|
-
color={theme.colors.error.primary}
|
|
368
|
-
typography={'description_default_regular'}
|
|
369
|
-
style={styles.txtMonthLunar}>
|
|
370
|
-
{labelDate}
|
|
371
|
-
</Text>
|
|
372
|
-
<Text
|
|
373
|
-
typography={'description_default_regular'}
|
|
374
|
-
style={styles.subTextLunar}>
|
|
375
|
-
{`${translate(labelHoliday)}`}
|
|
376
|
-
</Text>
|
|
377
|
-
<Text typography={'description_default_regular'}>
|
|
378
|
-
{labelHighlight}
|
|
379
|
-
</Text>
|
|
380
|
-
</View>
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
)}
|
|
384
|
-
</ScrollView>
|
|
385
|
-
)}
|
|
227
|
+
{translate?.(Util.mapWeeKDate(dayIdx))}
|
|
228
|
+
</Text>
|
|
229
|
+
))}
|
|
230
|
+
</View>
|
|
231
|
+
<MonthList
|
|
232
|
+
ref={monthListRef}
|
|
233
|
+
today={today}
|
|
234
|
+
minDate={minDate}
|
|
235
|
+
maxDate={maxDate}
|
|
236
|
+
startDate={startDate!}
|
|
237
|
+
endDate={endDate!}
|
|
238
|
+
onChoose={onChooseDay}
|
|
239
|
+
onScrollCalendar={onScrollCalendar}
|
|
240
|
+
isShowLunar={!isOffLunar && showLunar}
|
|
241
|
+
isDoubleDateMode={isDoubleDateMode}
|
|
242
|
+
tabSelected={tabSelected}
|
|
243
|
+
lunarConverter={converter}
|
|
244
|
+
holidays={holidays}
|
|
245
|
+
selectedDate={propSelectedDate}
|
|
246
|
+
priceList={priceListFormat}
|
|
247
|
+
disabledDays={disabledDays}
|
|
248
|
+
/>
|
|
249
|
+
</View>
|
|
250
|
+
{!isOffLunar && (
|
|
251
|
+
<View
|
|
252
|
+
style={[
|
|
253
|
+
styles.viewLunar,
|
|
254
|
+
{borderColor: theme.colors.border.default},
|
|
255
|
+
]}>
|
|
256
|
+
<CheckBox
|
|
257
|
+
onChange={onToggleLunar}
|
|
258
|
+
value={showLunar}
|
|
259
|
+
label={translate?.('showLunar')}
|
|
260
|
+
/>
|
|
386
261
|
</View>
|
|
387
262
|
)}
|
|
388
|
-
|
|
263
|
+
{!isHideHoliday && (
|
|
264
|
+
<ScrollView
|
|
265
|
+
contentContainerStyle={styles.contentScroll}
|
|
266
|
+
showsVerticalScrollIndicator={false}
|
|
267
|
+
nestedScrollEnabled>
|
|
268
|
+
{temp.map((item, idx) => {
|
|
269
|
+
const labelDate = `${item.day > 9 ? item.day : `0${item.day}`}/${
|
|
270
|
+
item.month > 9 ? item.month : `0${item.month}`
|
|
271
|
+
}`;
|
|
272
|
+
const labelHoliday = showLunar
|
|
273
|
+
? item.mixedLabel || item.label
|
|
274
|
+
: item.label;
|
|
275
|
+
const labelHighlight = showLunar ? item.highlight || '' : '';
|
|
276
|
+
return (
|
|
277
|
+
<View style={styles.row} key={idx.toString()}>
|
|
278
|
+
<Text
|
|
279
|
+
color={theme.colors.error.primary}
|
|
280
|
+
typography="description_default_regular"
|
|
281
|
+
style={styles.txtMonthLunar}>
|
|
282
|
+
{labelDate}
|
|
283
|
+
</Text>
|
|
284
|
+
<Text
|
|
285
|
+
typography="description_default_regular"
|
|
286
|
+
style={styles.subTextLunar}>
|
|
287
|
+
{translate?.(labelHoliday)}
|
|
288
|
+
</Text>
|
|
289
|
+
<Text typography="description_default_regular">
|
|
290
|
+
{labelHighlight}
|
|
291
|
+
</Text>
|
|
292
|
+
</View>
|
|
293
|
+
);
|
|
294
|
+
})}
|
|
295
|
+
</ScrollView>
|
|
296
|
+
)}
|
|
297
|
+
</View>
|
|
389
298
|
);
|
|
390
299
|
}
|
|
391
|
-
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
export default CalendarPro;
|