@momo-kits/calendar 0.0.62-alpha.2 → 0.0.62-alpha.23
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 +1 -1
- package/src/Calendar.js +3 -10
- package/src/CalendarPro.js +7 -8
- package/src/Day/index.js +3 -23
- package/src/Month/index.js +1 -0
- package/src/MonthList.js +2 -33
package/package.json
CHANGED
package/src/Calendar.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
View,
|
|
5
|
-
ScrollView,
|
|
6
|
-
Platform,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Dimensions,
|
|
9
|
-
} from 'react-native';
|
|
3
|
+
import { Dimensions, ScrollView, StyleSheet, View } from 'react-native';
|
|
10
4
|
import moment from 'moment';
|
|
11
5
|
import {
|
|
12
|
-
Text,
|
|
13
|
-
SwitchLanguage,
|
|
14
6
|
Colors,
|
|
15
|
-
Spacing,
|
|
16
7
|
Radius,
|
|
17
8
|
ScaleSize,
|
|
9
|
+
SwitchLanguage,
|
|
10
|
+
Text,
|
|
18
11
|
} from '@momo-kits/core-v2';
|
|
19
12
|
import Switch from '@momo-kits/switch';
|
|
20
13
|
import CalendarPro from './CalendarPro';
|
package/src/CalendarPro.js
CHANGED
|
@@ -3,22 +3,21 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
View,
|
|
7
6
|
Dimensions,
|
|
8
7
|
ScrollView,
|
|
9
|
-
TouchableWithoutFeedback,
|
|
10
8
|
StyleSheet,
|
|
9
|
+
TouchableWithoutFeedback,
|
|
10
|
+
View,
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import Moment from 'moment';
|
|
13
13
|
import {
|
|
14
|
-
SwitchLanguage,
|
|
15
|
-
LocalizedStrings,
|
|
16
|
-
Image,
|
|
17
|
-
IconSource,
|
|
18
|
-
Text,
|
|
19
14
|
Colors,
|
|
20
|
-
|
|
15
|
+
IconSource,
|
|
16
|
+
Image,
|
|
21
17
|
Radius,
|
|
18
|
+
Spacing,
|
|
19
|
+
SwitchLanguage,
|
|
20
|
+
Text,
|
|
22
21
|
} from '@momo-kits/core-v2';
|
|
23
22
|
import MonthList from './MonthList';
|
|
24
23
|
import HeaderControl from './HeaderControl';
|
package/src/Day/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { TouchableHighlight, View } from 'react-native';
|
|
4
|
+
import { Colors, Spacing, Text } from '@momo-kits/core-v2';
|
|
6
5
|
import style from './style';
|
|
7
6
|
|
|
8
7
|
class Day extends Component {
|
|
@@ -45,12 +44,10 @@ class Day extends Component {
|
|
|
45
44
|
empty,
|
|
46
45
|
index,
|
|
47
46
|
isShowLunar,
|
|
48
|
-
tabSelected,
|
|
49
47
|
isDoubleDateMode,
|
|
50
48
|
lunarDate,
|
|
51
49
|
isSolarHoliday,
|
|
52
50
|
isLunarHoliday,
|
|
53
|
-
price,
|
|
54
51
|
} = props || this.props;
|
|
55
52
|
this.isValid =
|
|
56
53
|
date &&
|
|
@@ -71,13 +68,6 @@ class Day extends Component {
|
|
|
71
68
|
this.isLunarDayStart = this.lunarDate && this.lunarDate.lunarDay === 1;
|
|
72
69
|
this.isSolarHoliday = isSolarHoliday;
|
|
73
70
|
this.isInScope = true;
|
|
74
|
-
// isDoubleDateMode
|
|
75
|
-
// ? tabSelected === 0 ||
|
|
76
|
-
// (tabSelected === 1 &&
|
|
77
|
-
// startDate &&
|
|
78
|
-
// date &&
|
|
79
|
-
// date.isSameOrAfter(startDate, 'day'))
|
|
80
|
-
// : true;
|
|
81
71
|
return this.isFocus || this.diffPrice;
|
|
82
72
|
};
|
|
83
73
|
|
|
@@ -121,17 +111,7 @@ class Day extends Component {
|
|
|
121
111
|
}
|
|
122
112
|
|
|
123
113
|
render() {
|
|
124
|
-
const {
|
|
125
|
-
date,
|
|
126
|
-
empty,
|
|
127
|
-
isDoubleDateMode,
|
|
128
|
-
price,
|
|
129
|
-
isBestPrice,
|
|
130
|
-
isShowPrice,
|
|
131
|
-
labelFrom,
|
|
132
|
-
labelTo,
|
|
133
|
-
isHideLabel,
|
|
134
|
-
} = this.props;
|
|
114
|
+
const { date, empty, price, isBestPrice } = this.props;
|
|
135
115
|
const text = date ? date.date() : '';
|
|
136
116
|
return (
|
|
137
117
|
<View style={style.dayContainer}>
|
package/src/Month/index.js
CHANGED
package/src/MonthList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react/no-did-update-set-state */
|
|
2
2
|
import React, { Component } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { Dimensions, FlatList, Platform } from 'react-native';
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import Month from './Month';
|
|
6
6
|
import style from './Day/style';
|
|
@@ -29,20 +29,11 @@ export default class MonthList extends Component {
|
|
|
29
29
|
this.holidays = props.holidays;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
// componentDidUpdate(prevProps) {
|
|
33
|
-
// const { isDoubleDateMode } = this.props;
|
|
34
|
-
// if (isDoubleDateMode !== prevProps.isDoubleDateMode) {
|
|
35
|
-
// this.setState({
|
|
36
|
-
// // data: this.getMonthList(this.props),
|
|
37
|
-
// isDoubleDateMode
|
|
38
|
-
// });
|
|
39
|
-
// }
|
|
40
|
-
// }
|
|
41
|
-
|
|
42
32
|
renderMonth = ({ item, index }) => {
|
|
43
33
|
const { isDoubleDateMode, priceList } = this.props;
|
|
44
34
|
const keyMonth = moment(item.date)?.format('YYYY-MM');
|
|
45
35
|
const priceListDate = priceList?.[keyMonth]?.day;
|
|
36
|
+
|
|
46
37
|
return (
|
|
47
38
|
<Month
|
|
48
39
|
{...this.props}
|
|
@@ -177,28 +168,6 @@ export default class MonthList extends Component {
|
|
|
177
168
|
getIndexOfMonth = (month, data) =>
|
|
178
169
|
data.findIndex((item) => item.date.isSame(month, 'month'));
|
|
179
170
|
|
|
180
|
-
// componentDidMount() {
|
|
181
|
-
// const {
|
|
182
|
-
// selectedDate
|
|
183
|
-
// } = this.props;
|
|
184
|
-
// const data = this.getMonthList();
|
|
185
|
-
// this.currentScrollIndex = this.getIndexOfMonth(moment(selectedDate), data);
|
|
186
|
-
// this.setState({ data });
|
|
187
|
-
// }
|
|
188
|
-
// componentDidMount() {
|
|
189
|
-
// if (this.list.current) {
|
|
190
|
-
// this.scrollToMonth(moment(this.props.selectedDate));
|
|
191
|
-
// }
|
|
192
|
-
// }
|
|
193
|
-
|
|
194
|
-
// componentWillUnmount() {
|
|
195
|
-
// const { isDoubleDateMode } = this.props;
|
|
196
|
-
// this.setState({
|
|
197
|
-
// // data: [],
|
|
198
|
-
// isDoubleDateMode
|
|
199
|
-
// });
|
|
200
|
-
// }
|
|
201
|
-
|
|
202
171
|
getCurrentVisibleMonth = (info) => {
|
|
203
172
|
const { changed } = info;
|
|
204
173
|
const { onScrollCalendar } = this.props;
|