@momo-kits/calendar 0.0.55-beta.20 → 0.0.55-beta.22
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/package.json +2 -2
- package/src/Calendar.js +32 -4
- package/src/CalendarPro.js +25 -30
- package/src/Day/index.js +71 -21
- package/src/Day/style.js +27 -29
- package/src/HeaderControl.js +6 -5
- package/src/Month/index.js +24 -19
- package/src/MonthList.js +4 -2
- package/src/TabHeader.js +7 -13
- package/src/calendarPicker/Day.js +1 -2
- package/src/calendarPicker/WeekDaysLabels.js +2 -2
package/package.json
CHANGED
package/src/Calendar.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
View,
|
|
5
|
+
ScrollView,
|
|
6
|
+
Platform,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Dimensions,
|
|
9
|
+
} from 'react-native';
|
|
4
10
|
import moment from 'moment';
|
|
5
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Text,
|
|
13
|
+
SwitchLanguage,
|
|
14
|
+
Colors,
|
|
15
|
+
Spacing,
|
|
16
|
+
Radius,
|
|
17
|
+
ScaleSize,
|
|
18
|
+
} from '@momo-kits/core';
|
|
6
19
|
import Switch from '@momo-kits/switch';
|
|
7
20
|
import CalendarPro from './CalendarPro';
|
|
8
21
|
import TabHeader from './TabHeader';
|
|
@@ -416,10 +429,19 @@ class Calendar extends Component {
|
|
|
416
429
|
maxDate,
|
|
417
430
|
doubleDate,
|
|
418
431
|
isHideHeaderPanel,
|
|
432
|
+
style,
|
|
419
433
|
} = this.props;
|
|
420
434
|
const { isDoubleDateMode } = this.state;
|
|
435
|
+
const { width } = Dimensions.get('window');
|
|
421
436
|
return (
|
|
422
|
-
<ScrollView
|
|
437
|
+
<ScrollView
|
|
438
|
+
style={[
|
|
439
|
+
styles.scrollView,
|
|
440
|
+
{
|
|
441
|
+
width: width - ScaleSize(24),
|
|
442
|
+
},
|
|
443
|
+
style,
|
|
444
|
+
]}>
|
|
423
445
|
<View
|
|
424
446
|
style={{
|
|
425
447
|
backgroundColor: Colors.black_01,
|
|
@@ -429,6 +451,7 @@ class Calendar extends Component {
|
|
|
429
451
|
{!isHideHeaderPanel && this.renderHeaderPanel()}
|
|
430
452
|
</View>
|
|
431
453
|
<CalendarPro
|
|
454
|
+
priceList={priceList}
|
|
432
455
|
ref={this.calendarPicker}
|
|
433
456
|
startDate={doubleDate?.first}
|
|
434
457
|
endDate={doubleDate?.second}
|
|
@@ -437,7 +460,6 @@ class Calendar extends Component {
|
|
|
437
460
|
selectedDate={this.selectedDate}
|
|
438
461
|
isShowLunar={isShowLunar}
|
|
439
462
|
onCallbackCalendar={onCallbackCalendar}
|
|
440
|
-
priceList={priceList}
|
|
441
463
|
labelFrom={labelFrom}
|
|
442
464
|
labelTo={labelTo}
|
|
443
465
|
isHideLabel={isHideLabel}
|
|
@@ -481,6 +503,7 @@ Calendar.propTypes = {
|
|
|
481
503
|
PropTypes.string,
|
|
482
504
|
PropTypes.instanceOf(Date),
|
|
483
505
|
]),
|
|
506
|
+
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
484
507
|
};
|
|
485
508
|
|
|
486
509
|
Calendar.defaultProps = {
|
|
@@ -521,4 +544,9 @@ const styles = StyleSheet.create({
|
|
|
521
544
|
paddingHorizontal: 12,
|
|
522
545
|
paddingVertical: 8,
|
|
523
546
|
},
|
|
547
|
+
scrollView: {
|
|
548
|
+
flex: 1,
|
|
549
|
+
backgroundColor: 'transparent',
|
|
550
|
+
alignSelf: 'center',
|
|
551
|
+
},
|
|
524
552
|
});
|
package/src/CalendarPro.js
CHANGED
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import Moment from 'moment';
|
|
13
13
|
import {
|
|
14
|
-
Text,
|
|
15
14
|
SwitchLanguage,
|
|
16
15
|
LocalizedStrings,
|
|
17
|
-
Colors,
|
|
18
16
|
Image,
|
|
19
17
|
IconSource,
|
|
18
|
+
Text,
|
|
19
|
+
Colors,
|
|
20
20
|
Spacing,
|
|
21
21
|
Radius,
|
|
22
22
|
} from '@momo-kits/core';
|
|
@@ -251,7 +251,7 @@ export default class CalendarPro extends Component {
|
|
|
251
251
|
onPressNextArrow={this.onPressNextArrow}
|
|
252
252
|
/>
|
|
253
253
|
<View style={styles.blueSeperator} />
|
|
254
|
-
<View
|
|
254
|
+
<View>
|
|
255
255
|
<View style={styles.viewDay}>
|
|
256
256
|
{[1, 2, 3, 4, 5, 6, 7].map((item) => (
|
|
257
257
|
<Text
|
|
@@ -293,10 +293,15 @@ export default class CalendarPro extends Component {
|
|
|
293
293
|
</View>
|
|
294
294
|
</View>
|
|
295
295
|
{!isOffLunar && (
|
|
296
|
-
<View style={styles.viewLunar}>
|
|
296
|
+
<View style={[styles.viewLunar]}>
|
|
297
297
|
<TouchableWithoutFeedback
|
|
298
298
|
onPress={this.toggleLunarDate}>
|
|
299
299
|
<Image
|
|
300
|
+
tintColor={
|
|
301
|
+
showLunar
|
|
302
|
+
? Colors.pink_05_b
|
|
303
|
+
: Colors.black_17
|
|
304
|
+
}
|
|
300
305
|
source={
|
|
301
306
|
showLunar
|
|
302
307
|
? IconSource.ic_checkbox_checked_24
|
|
@@ -305,11 +310,11 @@ export default class CalendarPro extends Component {
|
|
|
305
310
|
style={styles.iconSelected}
|
|
306
311
|
/>
|
|
307
312
|
</TouchableWithoutFeedback>
|
|
308
|
-
<Text
|
|
313
|
+
<Text
|
|
309
314
|
style={styles.txtLunar}
|
|
310
315
|
onPress={this.toggleLunarDate}>
|
|
311
316
|
{SwitchLanguage.showLunar}
|
|
312
|
-
</Text
|
|
317
|
+
</Text>
|
|
313
318
|
</View>
|
|
314
319
|
)}
|
|
315
320
|
|
|
@@ -327,12 +332,13 @@ export default class CalendarPro extends Component {
|
|
|
327
332
|
const labelHighlight = showLunar
|
|
328
333
|
? item.highlight || ''
|
|
329
334
|
: '';
|
|
330
|
-
const labelDate =
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
:
|
|
335
|
+
const labelDate = `${
|
|
336
|
+
item.day > 9 ? item.day : `0${item.day}`
|
|
337
|
+
}/${
|
|
338
|
+
item.month > 9
|
|
339
|
+
? item.month
|
|
340
|
+
: `0${item.month}`
|
|
341
|
+
}`;
|
|
336
342
|
return (
|
|
337
343
|
<View
|
|
338
344
|
style={styles.row}
|
|
@@ -344,16 +350,6 @@ export default class CalendarPro extends Component {
|
|
|
344
350
|
<Text.SubTitle
|
|
345
351
|
style={styles.subTextLunar}>
|
|
346
352
|
{`${labelHoliday} `}
|
|
347
|
-
{labelHighlight ? (
|
|
348
|
-
<Text
|
|
349
|
-
style={{
|
|
350
|
-
color: Colors.red_05,
|
|
351
|
-
}}>
|
|
352
|
-
{labelHighlight}
|
|
353
|
-
</Text>
|
|
354
|
-
) : (
|
|
355
|
-
''
|
|
356
|
-
)}
|
|
357
353
|
</Text.SubTitle>
|
|
358
354
|
</View>
|
|
359
355
|
);
|
|
@@ -390,7 +386,7 @@ CalendarPro.defaultProps = {
|
|
|
390
386
|
|
|
391
387
|
const styles = StyleSheet.create({
|
|
392
388
|
row: { flexDirection: 'row' },
|
|
393
|
-
txtMonthLunar: { color: Colors.red_05,
|
|
389
|
+
txtMonthLunar: { color: Colors.red_05, marginRight: Spacing.S },
|
|
394
390
|
subTextLunar: {
|
|
395
391
|
// fontSize: 12,
|
|
396
392
|
color: '#222222',
|
|
@@ -402,21 +398,20 @@ const styles = StyleSheet.create({
|
|
|
402
398
|
txtLunar: {
|
|
403
399
|
paddingLeft: 6,
|
|
404
400
|
color: '#222222',
|
|
405
|
-
|
|
406
|
-
lineHeight: 14,
|
|
401
|
+
fontSize: 14,
|
|
407
402
|
},
|
|
408
403
|
viewLunar: {
|
|
409
404
|
flexDirection: 'row',
|
|
410
405
|
alignItems: 'center',
|
|
411
|
-
marginHorizontal:
|
|
412
|
-
|
|
413
|
-
|
|
406
|
+
marginHorizontal: Spacing.M,
|
|
407
|
+
borderTopWidth: 1,
|
|
408
|
+
paddingTop: Spacing.M,
|
|
414
409
|
borderStyle: 'solid',
|
|
415
|
-
borderColor:
|
|
410
|
+
borderColor: Colors.black_04,
|
|
416
411
|
},
|
|
417
412
|
viewDate: {},
|
|
418
413
|
textDay: {
|
|
419
|
-
|
|
414
|
+
fontSize: 12,
|
|
420
415
|
lineHeight: 16,
|
|
421
416
|
width: (widthScreen - 38) / 7,
|
|
422
417
|
textAlign: 'center',
|
package/src/Day/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
import { View, TouchableHighlight
|
|
5
|
-
import {
|
|
4
|
+
import { View, TouchableHighlight } from 'react-native';
|
|
5
|
+
import { Spacing, SwitchLanguage, Colors, Text } from '@momo-kits/core';
|
|
6
6
|
import style from './style';
|
|
7
7
|
|
|
8
8
|
class Day extends Component {
|
|
@@ -144,13 +144,18 @@ class Day extends Component {
|
|
|
144
144
|
<TouchableHighlight
|
|
145
145
|
style={[
|
|
146
146
|
style.day,
|
|
147
|
+
{
|
|
148
|
+
paddingVertical: !!price
|
|
149
|
+
? Spacing.XS
|
|
150
|
+
: Spacing.S,
|
|
151
|
+
},
|
|
147
152
|
(this.isStart || this.isEnd) && style.focused,
|
|
148
153
|
]}
|
|
149
154
|
underlayColor="rgba(255, 255, 255, 0.35)"
|
|
150
155
|
onPress={this.chooseDay}>
|
|
151
156
|
<>
|
|
152
157
|
{this.lunarDate && this.showLunar && (
|
|
153
|
-
<Text
|
|
158
|
+
<Text.Caption
|
|
154
159
|
style={[
|
|
155
160
|
style.lunarDayText,
|
|
156
161
|
(this.isLunarHoliday ||
|
|
@@ -162,24 +167,58 @@ class Day extends Component {
|
|
|
162
167
|
{this.lunarDate.lunarDay === 1
|
|
163
168
|
? `${this.lunarDate.lunarDay}/${this.lunarDate.lunarMonth}`
|
|
164
169
|
: this.lunarDate.lunarDay}
|
|
165
|
-
</Text>
|
|
170
|
+
</Text.Caption>
|
|
166
171
|
)}
|
|
167
|
-
<Text
|
|
172
|
+
<Text.Title
|
|
168
173
|
style={[
|
|
169
174
|
style.dayText,
|
|
175
|
+
{ paddingTop: !!price ? 4 : 0 },
|
|
170
176
|
this.isWeekEnd && style.weekendDay,
|
|
171
177
|
this.isSolarHoliday && style.weekendDay,
|
|
172
178
|
(this.isStart || this.isEnd) &&
|
|
173
179
|
style.focusedText,
|
|
174
180
|
]}>
|
|
175
181
|
{text}
|
|
176
|
-
</Text>
|
|
182
|
+
</Text.Title>
|
|
183
|
+
{!!price ? (
|
|
184
|
+
<Text.Caption
|
|
185
|
+
style={[
|
|
186
|
+
this.isValid && this.isInScope
|
|
187
|
+
? style.price
|
|
188
|
+
: style.dayTextDisabled,
|
|
189
|
+
isBestPrice && {
|
|
190
|
+
color: Colors.pink_03,
|
|
191
|
+
},
|
|
192
|
+
(this.isStart || this.isEnd) && {
|
|
193
|
+
color: Colors.black_01,
|
|
194
|
+
},
|
|
195
|
+
]}>
|
|
196
|
+
{price}
|
|
197
|
+
</Text.Caption>
|
|
198
|
+
) : (
|
|
199
|
+
<View
|
|
200
|
+
style={{
|
|
201
|
+
paddingBottom: this.props
|
|
202
|
+
.havePriceList
|
|
203
|
+
? Spacing.S
|
|
204
|
+
: 0,
|
|
205
|
+
}}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
177
208
|
</>
|
|
178
209
|
</TouchableHighlight>
|
|
179
210
|
) : (
|
|
180
|
-
<View
|
|
211
|
+
<View
|
|
212
|
+
style={[
|
|
213
|
+
style.day,
|
|
214
|
+
{
|
|
215
|
+
paddingVertical: !!price
|
|
216
|
+
? Spacing.XS + Spacing.XXS
|
|
217
|
+
: Spacing.S,
|
|
218
|
+
},
|
|
219
|
+
]}>
|
|
181
220
|
{this.lunarDate && this.showLunar && text ? (
|
|
182
|
-
<Text
|
|
221
|
+
<Text.Caption
|
|
183
222
|
style={[
|
|
184
223
|
style.lunarDayText,
|
|
185
224
|
style.dayTextDisabled,
|
|
@@ -187,27 +226,38 @@ class Day extends Component {
|
|
|
187
226
|
{this.lunarDate.lunarDay === 1
|
|
188
227
|
? `${this.lunarDate.lunarDay}/${this.lunarDate.lunarMonth}`
|
|
189
228
|
: this.lunarDate.lunarDay}
|
|
190
|
-
</Text>
|
|
229
|
+
</Text.Caption>
|
|
191
230
|
) : (
|
|
192
231
|
<View />
|
|
193
232
|
)}
|
|
194
|
-
<Text
|
|
233
|
+
<Text.Title
|
|
195
234
|
style={[style.dayText, style.dayTextDisabled]}>
|
|
196
235
|
{text}
|
|
197
|
-
</Text>
|
|
236
|
+
</Text.Title>
|
|
237
|
+
{text && !!price ? (
|
|
238
|
+
<Text.Caption
|
|
239
|
+
style={[
|
|
240
|
+
this.isValid && this.isInScope
|
|
241
|
+
? style.price
|
|
242
|
+
: style.dayTextDisabled,
|
|
243
|
+
isBestPrice && {
|
|
244
|
+
color: Colors.pink_05_b,
|
|
245
|
+
},
|
|
246
|
+
]}>
|
|
247
|
+
{price}
|
|
248
|
+
</Text.Caption>
|
|
249
|
+
) : (
|
|
250
|
+
<View
|
|
251
|
+
style={{
|
|
252
|
+
paddingBottom: this.props.havePriceList
|
|
253
|
+
? Spacing.S
|
|
254
|
+
: 0,
|
|
255
|
+
}}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
198
258
|
</View>
|
|
199
259
|
)}
|
|
200
260
|
</View>
|
|
201
|
-
|
|
202
|
-
{this.isValid && this.isInScope && !!price && (
|
|
203
|
-
<Text
|
|
204
|
-
style={[
|
|
205
|
-
style.price,
|
|
206
|
-
isBestPrice && { color: Colors.pink_05_b },
|
|
207
|
-
]}>
|
|
208
|
-
{price}
|
|
209
|
-
</Text>
|
|
210
|
-
)}
|
|
211
261
|
</View>
|
|
212
262
|
);
|
|
213
263
|
}
|
package/src/Day/style.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Dimensions } from 'react-native';
|
|
2
|
-
import { Colors } from '@momo-kits/core';
|
|
2
|
+
import { Spacing, Colors } from '@momo-kits/core';
|
|
3
3
|
|
|
4
4
|
const dayWidth = (Dimensions.get('window').width - 38) / 7;
|
|
5
5
|
const SCREEN_WIDTH = Dimensions.get('window').width;
|
|
6
|
-
const SCREEN_DPI_WIDTH =
|
|
6
|
+
const SCREEN_DPI_WIDTH = SCREEN_WIDTH * Dimensions.get('window').scale;
|
|
7
7
|
const IPHONE_4_5_WIDTH = 640;
|
|
8
8
|
const dayTextSize = SCREEN_DPI_WIDTH === IPHONE_4_5_WIDTH ? 13 : 15;
|
|
9
9
|
const lunarTextSize = SCREEN_DPI_WIDTH === IPHONE_4_5_WIDTH ? 8 : 10;
|
|
@@ -11,7 +11,8 @@ const priceTextSize = SCREEN_DPI_WIDTH === IPHONE_4_5_WIDTH ? 8 : 10;
|
|
|
11
11
|
const lineHeightDayText = 1.3 * dayTextSize;
|
|
12
12
|
const lineHeightLunarText = 1.3 * lunarTextSize;
|
|
13
13
|
const lineHeightPriceText = 1.3 * priceTextSize;
|
|
14
|
-
const containerDayHeight =
|
|
14
|
+
const containerDayHeight =
|
|
15
|
+
lineHeightDayText + lineHeightLunarText + lineHeightPriceText + 10;
|
|
15
16
|
const heightDefault = lineHeightDayText + lineHeightLunarText;
|
|
16
17
|
export default {
|
|
17
18
|
dayContainer: {
|
|
@@ -22,55 +23,52 @@ export default {
|
|
|
22
23
|
},
|
|
23
24
|
day: {
|
|
24
25
|
width: dayWidth,
|
|
25
|
-
paddingVertical: 5,
|
|
26
26
|
overflow: 'hidden',
|
|
27
27
|
justifyContent: 'center',
|
|
28
28
|
alignItems: 'center',
|
|
29
29
|
borderRadius: 4,
|
|
30
|
-
height: heightDefault + 5
|
|
31
30
|
},
|
|
32
31
|
dayText: {
|
|
33
|
-
|
|
32
|
+
lineHeight: 24,
|
|
34
33
|
textAlign: 'center',
|
|
35
|
-
fontWeight: 'bold',
|
|
36
|
-
color: '#222222'
|
|
37
34
|
},
|
|
38
35
|
lunarDayText: {
|
|
39
36
|
width: dayWidth,
|
|
40
37
|
textAlign: 'right',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
paddingRight: Spacing.XS,
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: Spacing.XXS,
|
|
41
|
+
lineHeight: 14,
|
|
44
42
|
},
|
|
45
43
|
todayText: {
|
|
46
|
-
color: 'blue'
|
|
44
|
+
color: 'blue',
|
|
47
45
|
},
|
|
48
46
|
weekendDay: {
|
|
49
|
-
color:
|
|
47
|
+
color: Colors.red_05,
|
|
50
48
|
},
|
|
51
49
|
dayTextDisabled: {
|
|
52
|
-
opacity: 0.
|
|
50
|
+
opacity: 0.4,
|
|
53
51
|
},
|
|
52
|
+
|
|
54
53
|
focused: {
|
|
55
|
-
backgroundColor: Colors.pink_05_b
|
|
54
|
+
backgroundColor: Colors.pink_05_b,
|
|
56
55
|
},
|
|
57
56
|
focusedText: {
|
|
58
|
-
|
|
57
|
+
fontWeight: 'bold',
|
|
58
|
+
color: 'white',
|
|
59
59
|
},
|
|
60
60
|
dayStartContainer: {
|
|
61
61
|
borderTopLeftRadius: 4,
|
|
62
62
|
borderBottomLeftRadius: 4,
|
|
63
|
-
backgroundColor: Colors.
|
|
64
|
-
// height: heightDefault
|
|
63
|
+
backgroundColor: Colors.pink_05_b,
|
|
65
64
|
},
|
|
66
65
|
dayEndContainer: {
|
|
67
66
|
borderTopRightRadius: 4,
|
|
68
67
|
borderBottomRightRadius: 4,
|
|
69
|
-
backgroundColor: Colors.
|
|
70
|
-
// height: heightDefault
|
|
68
|
+
backgroundColor: Colors.pink_05_b,
|
|
71
69
|
},
|
|
72
70
|
mid: {
|
|
73
|
-
backgroundColor: Colors.
|
|
71
|
+
backgroundColor: Colors.pink_11,
|
|
74
72
|
// height: heightDefault
|
|
75
73
|
},
|
|
76
74
|
departLabel: {
|
|
@@ -80,7 +78,7 @@ export default {
|
|
|
80
78
|
height: 20,
|
|
81
79
|
borderRadius: 10,
|
|
82
80
|
justifyContent: 'center',
|
|
83
|
-
alignItems: 'center'
|
|
81
|
+
alignItems: 'center',
|
|
84
82
|
},
|
|
85
83
|
returnLabel: {
|
|
86
84
|
position: 'absolute',
|
|
@@ -91,7 +89,7 @@ export default {
|
|
|
91
89
|
justifyContent: 'center',
|
|
92
90
|
alignItems: 'center',
|
|
93
91
|
top: 0,
|
|
94
|
-
right: 0
|
|
92
|
+
right: 0,
|
|
95
93
|
},
|
|
96
94
|
containerDayHeight,
|
|
97
95
|
txtBack: {
|
|
@@ -105,7 +103,7 @@ export default {
|
|
|
105
103
|
width: 15,
|
|
106
104
|
height: 15,
|
|
107
105
|
justifyContent: 'center',
|
|
108
|
-
alignItems: 'center'
|
|
106
|
+
alignItems: 'center',
|
|
109
107
|
},
|
|
110
108
|
txtGo: {
|
|
111
109
|
position: 'absolute',
|
|
@@ -118,12 +116,12 @@ export default {
|
|
|
118
116
|
width: 15,
|
|
119
117
|
height: 15,
|
|
120
118
|
justifyContent: 'center',
|
|
121
|
-
alignItems: 'center'
|
|
119
|
+
alignItems: 'center',
|
|
122
120
|
},
|
|
123
121
|
price: {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
122
|
+
color: Colors.black_15,
|
|
123
|
+
marginTop: -4,
|
|
124
|
+
lineHeight: 14,
|
|
127
125
|
},
|
|
128
|
-
lineHeightPriceText
|
|
126
|
+
lineHeightPriceText,
|
|
129
127
|
};
|
package/src/HeaderControl.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
3
|
import moment from 'moment';
|
|
4
|
-
import {
|
|
4
|
+
import { Icon, ScaleSize, Text, Colors, Spacing } from '@momo-kits/core';
|
|
5
|
+
|
|
5
6
|
import Util from './Util';
|
|
6
7
|
|
|
7
8
|
const HeaderControl = forwardRef(
|
|
@@ -33,7 +34,9 @@ const HeaderControl = forwardRef(
|
|
|
33
34
|
style={styles.icon}
|
|
34
35
|
/>
|
|
35
36
|
</TouchableOpacity>
|
|
36
|
-
<Text.
|
|
37
|
+
<Text.Title style={styles.txtHeader}>
|
|
38
|
+
{headerFormat}
|
|
39
|
+
</Text.Title>
|
|
37
40
|
<TouchableOpacity
|
|
38
41
|
style={styles.btnRight}
|
|
39
42
|
onPress={onPressNextArrow}>
|
|
@@ -55,10 +58,8 @@ const styles = StyleSheet.create({
|
|
|
55
58
|
icon: { width: 24, height: 24, resizeMode: 'contain' },
|
|
56
59
|
txtHeader: {
|
|
57
60
|
// fontSize: 15,
|
|
58
|
-
lineHeight: 19,
|
|
59
61
|
fontWeight: 'bold',
|
|
60
62
|
textAlign: 'center',
|
|
61
|
-
color: Colors.black_17,
|
|
62
63
|
},
|
|
63
64
|
btnRight: {
|
|
64
65
|
width: 36,
|
|
@@ -76,7 +77,7 @@ const styles = StyleSheet.create({
|
|
|
76
77
|
height: ScaleSize(44),
|
|
77
78
|
flexDirection: 'row',
|
|
78
79
|
justifyContent: 'space-between',
|
|
79
|
-
backgroundColor: Colors.
|
|
80
|
+
backgroundColor: Colors.blue_11,
|
|
80
81
|
alignItems: 'center',
|
|
81
82
|
borderRadius: 4,
|
|
82
83
|
},
|
package/src/Month/index.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import React, { PureComponent } from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
View
|
|
5
|
-
} from 'react-native';
|
|
3
|
+
import { View, Dimensions } from 'react-native';
|
|
6
4
|
import moment from 'moment';
|
|
7
5
|
import Day from '../Day';
|
|
6
|
+
import { Spacing, ScaleSize } from '@momo-kits/core';
|
|
7
|
+
|
|
8
|
+
const { width } = Dimensions.get('window');
|
|
8
9
|
|
|
9
10
|
export default class Month extends PureComponent {
|
|
10
11
|
constructor(props) {
|
|
11
12
|
super(props);
|
|
12
13
|
const { dateList } = props;
|
|
13
14
|
this.rowArray = new Array(dateList.length / 7).fill('');
|
|
14
|
-
this.temp = this.rowArray.map((item, i) =>
|
|
15
|
+
this.temp = this.rowArray.map((item, i) =>
|
|
16
|
+
dateList.slice(i * 7, i * 7 + 7),
|
|
17
|
+
);
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
findHoliday = (date) => {
|
|
@@ -19,7 +22,9 @@ export default class Month extends PureComponent {
|
|
|
19
22
|
if (date && holidays && holidays.length > 0) {
|
|
20
23
|
const day = date.date();
|
|
21
24
|
const month = date.month() + 1;
|
|
22
|
-
return holidays.find(
|
|
25
|
+
return holidays.find(
|
|
26
|
+
(item) => item.day === day && item.month === month,
|
|
27
|
+
);
|
|
23
28
|
}
|
|
24
29
|
return null;
|
|
25
30
|
};
|
|
@@ -28,7 +33,7 @@ export default class Month extends PureComponent {
|
|
|
28
33
|
const holiday = this.findHoliday(date);
|
|
29
34
|
return {
|
|
30
35
|
isSolarHoliday: !!(holiday && !holiday.lunar),
|
|
31
|
-
isLunarHoliday: !!(holiday && holiday.lunar)
|
|
36
|
+
isLunarHoliday: !!(holiday && holiday.lunar),
|
|
32
37
|
};
|
|
33
38
|
};
|
|
34
39
|
|
|
@@ -36,10 +41,9 @@ export default class Month extends PureComponent {
|
|
|
36
41
|
<View
|
|
37
42
|
style={{
|
|
38
43
|
flexDirection: 'row',
|
|
39
|
-
justifyContent: 'space-between'
|
|
44
|
+
justifyContent: 'space-between',
|
|
40
45
|
}}
|
|
41
|
-
key={`row${index}`}
|
|
42
|
-
>
|
|
46
|
+
key={`row${index}`}>
|
|
43
47
|
{dayList.map((item, i) => {
|
|
44
48
|
const keyDay = moment(item.date).format('YYYY-MM-DD');
|
|
45
49
|
const priceInfo = this.props?.priceListDate?.[keyDay];
|
|
@@ -48,6 +52,7 @@ export default class Month extends PureComponent {
|
|
|
48
52
|
{...this.props}
|
|
49
53
|
{...this.checkHoliday(item.date)}
|
|
50
54
|
date={item.date}
|
|
55
|
+
havePriceList={!!this.props.priceListDate}
|
|
51
56
|
lunarDate={item.lunarDate}
|
|
52
57
|
empty={item.empty}
|
|
53
58
|
key={`day${i.toString()}`}
|
|
@@ -56,25 +61,25 @@ export default class Month extends PureComponent {
|
|
|
56
61
|
isBestPrice={priceInfo?.isBestPrice}
|
|
57
62
|
/>
|
|
58
63
|
);
|
|
59
|
-
}
|
|
60
|
-
)}
|
|
64
|
+
})}
|
|
61
65
|
</View>
|
|
62
66
|
);
|
|
63
|
-
|
|
64
67
|
render() {
|
|
65
|
-
const {
|
|
66
|
-
month
|
|
67
|
-
} = this.props;
|
|
68
|
+
const { month } = this.props;
|
|
68
69
|
if (month) {
|
|
69
70
|
return (
|
|
70
71
|
<View>
|
|
71
|
-
<View
|
|
72
|
-
{
|
|
73
|
-
|
|
72
|
+
<View
|
|
73
|
+
style={{
|
|
74
|
+
paddingHorizontal: Spacing.S,
|
|
75
|
+
paddingVertical: 5,
|
|
76
|
+
width: width - ScaleSize(24),
|
|
77
|
+
}}>
|
|
78
|
+
{this.temp.map((item, i) => this.renderDayRow(item, i))}
|
|
74
79
|
</View>
|
|
75
80
|
</View>
|
|
76
81
|
);
|
|
77
82
|
}
|
|
78
|
-
return
|
|
83
|
+
return <View />;
|
|
79
84
|
}
|
|
80
85
|
}
|
package/src/MonthList.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable react/no-did-update-set-state */
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import { FlatList, Dimensions, Platform } from 'react-native';
|
|
3
|
+
import { FlatList, Dimensions, Platform, View } from 'react-native';
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import Month from './Month';
|
|
6
6
|
import style from './Day/style';
|
|
7
7
|
import LunarDateConverter from './LunarDateConverter';
|
|
8
|
+
import { ScaleSize } from '@momo-kits/core';
|
|
8
9
|
|
|
9
|
-
const ITEM_WIDTH = Dimensions.get('window').width - 24;
|
|
10
|
+
const ITEM_WIDTH = Dimensions.get('window').width - ScaleSize(24);
|
|
10
11
|
const MAX_RENDER_PER_BATCH = Platform.OS === 'android' ? 1 : 12;
|
|
11
12
|
|
|
12
13
|
const converter = new LunarDateConverter();
|
|
@@ -266,6 +267,7 @@ export default class MonthList extends Component {
|
|
|
266
267
|
onViewableItemsChanged={this.getCurrentVisibleMonth}
|
|
267
268
|
onScrollToIndexFailed={() => {}}
|
|
268
269
|
// removeClippedSubviews
|
|
270
|
+
scrollEnabled
|
|
269
271
|
initialNumToRender={1}
|
|
270
272
|
maxToRenderPerBatch={MAX_RENDER_PER_BATCH}
|
|
271
273
|
windowSize={3}
|
package/src/TabHeader.js
CHANGED
|
@@ -55,36 +55,30 @@ export default class TabHeader extends React.Component {
|
|
|
55
55
|
flex: 1,
|
|
56
56
|
backgroundColor: Colors.white,
|
|
57
57
|
}}>
|
|
58
|
-
<Text
|
|
58
|
+
<Text.SubTitle
|
|
59
59
|
style={{
|
|
60
60
|
fontSize: 12,
|
|
61
61
|
lineHeight: 16,
|
|
62
62
|
color: Colors.black_09,
|
|
63
63
|
}}>
|
|
64
64
|
{label}
|
|
65
|
-
</Text>
|
|
66
|
-
<Text
|
|
67
|
-
weight={active ? '
|
|
65
|
+
</Text.SubTitle>
|
|
66
|
+
<Text.Title
|
|
67
|
+
weight={active ? 'bold' : 'regular'}
|
|
68
68
|
style={{
|
|
69
69
|
marginTop: 3,
|
|
70
|
-
fontSize: 14,
|
|
71
|
-
color: Colors.black_17,
|
|
72
70
|
}}>
|
|
73
|
-
<Text
|
|
74
|
-
weight={active ? 'semibold' : 'regular'}
|
|
75
|
-
style={{
|
|
76
|
-
color: Colors.black_17,
|
|
77
|
-
}}>
|
|
71
|
+
<Text.Title weight={active ? 'bold' : 'regular'}>
|
|
78
72
|
{`${
|
|
79
73
|
dayOfWeekFromState ||
|
|
80
74
|
dayOfWeekFromDefault ||
|
|
81
75
|
'--'
|
|
82
76
|
} `}
|
|
83
|
-
</Text>
|
|
77
|
+
</Text.Title>
|
|
84
78
|
{formattedDateFromState ||
|
|
85
79
|
formattedDateFromDefault ||
|
|
86
80
|
'--/--/----'}
|
|
87
|
-
</Text>
|
|
81
|
+
</Text.Title>
|
|
88
82
|
</View>
|
|
89
83
|
</TouchableWithoutFeedback>
|
|
90
84
|
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { TouchableOpacity, View, Text } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { Text } from '@momo-kits/core';
|
|
5
4
|
import styles from './styles';
|
|
6
5
|
|
|
7
6
|
export default class Day extends Component {
|
|
@@ -9,11 +9,11 @@ const colorDay = '#9199a2';
|
|
|
9
9
|
const WeekDaysLabels = () => (
|
|
10
10
|
<View style={styles.dayLabelsWrapper}>
|
|
11
11
|
{WEEKDAYS.map((day, key) => (
|
|
12
|
-
<Text.
|
|
12
|
+
<Text.Title1
|
|
13
13
|
key={key.toString()}
|
|
14
14
|
style={[styles.dayLabels, { color: colorDay, fontSize: 16 }]}>
|
|
15
15
|
{day}
|
|
16
|
-
</Text.
|
|
16
|
+
</Text.Title1>
|
|
17
17
|
))}
|
|
18
18
|
</View>
|
|
19
19
|
);
|