@momo-kits/calendar 0.79.6-beta.3 → 0.79.6-beta.4
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/Day.tsx +1 -1
- package/Month.tsx +2 -1
- package/MonthList.tsx +9 -3
- package/TabHeader.tsx +1 -3
- package/index.tsx +6 -6
- package/package.json +1 -1
- package/types.ts +1 -1
package/Day.tsx
CHANGED
|
@@ -155,7 +155,7 @@ class Day extends Component<DayProps> {
|
|
|
155
155
|
let lunarTextColor = theme.colors.text.hint;
|
|
156
156
|
let priceColor = theme.colors.text.default;
|
|
157
157
|
|
|
158
|
-
if (this.isWeekEnd) {
|
|
158
|
+
if (this.isWeekEnd || this.isSolarHoliday || this.isLunarHoliday) {
|
|
159
159
|
textColor = theme.colors.error.primary;
|
|
160
160
|
priceColor = theme.colors.error.primary;
|
|
161
161
|
}
|
package/Month.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {View} from 'react-native';
|
|
|
4
4
|
import moment from 'moment';
|
|
5
5
|
import Moment from 'moment';
|
|
6
6
|
import Day from './Day';
|
|
7
|
-
import {Spacing} from '@momo-kits/foundation';
|
|
7
|
+
import {scaleSize, Spacing} from '@momo-kits/foundation';
|
|
8
8
|
import {MonthProps} from './types';
|
|
9
9
|
import {ContainerContext} from './index';
|
|
10
10
|
|
|
@@ -44,6 +44,7 @@ export default class Month extends PureComponent<MonthProps> {
|
|
|
44
44
|
flexDirection: 'row',
|
|
45
45
|
alignItems: 'center',
|
|
46
46
|
marginBottom: Spacing.XS,
|
|
47
|
+
height: scaleSize(48),
|
|
47
48
|
}}
|
|
48
49
|
key={`row${index}`}>
|
|
49
50
|
{dayList.map((item, i) => {
|
package/MonthList.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {Component} from 'react';
|
|
1
|
+
import React, {Component, useCallback} from 'react';
|
|
2
2
|
import {FlatList, Platform} from 'react-native';
|
|
3
3
|
import moment from 'moment';
|
|
4
4
|
import Moment from 'moment';
|
|
@@ -238,6 +238,12 @@ export default class MonthList extends Component<
|
|
|
238
238
|
index,
|
|
239
239
|
});
|
|
240
240
|
|
|
241
|
+
componentDidMount() {
|
|
242
|
+
setTimeout(() => {
|
|
243
|
+
this.scrollToMonth(this.currentDate);
|
|
244
|
+
}, 250);
|
|
245
|
+
}
|
|
246
|
+
|
|
241
247
|
render() {
|
|
242
248
|
const {priceList} = this.props;
|
|
243
249
|
return (
|
|
@@ -256,10 +262,10 @@ export default class MonthList extends Component<
|
|
|
256
262
|
onViewableItemsChanged={this.getCurrentVisibleMonth}
|
|
257
263
|
onScrollToIndexFailed={() => {}}
|
|
258
264
|
scrollEnabled
|
|
259
|
-
|
|
265
|
+
removeClippedSubviews
|
|
266
|
+
initialNumToRender={3}
|
|
260
267
|
maxToRenderPerBatch={MAX_RENDER_PER_BATCH}
|
|
261
268
|
windowSize={1}
|
|
262
|
-
contentContainerStyle={{paddingTop: 5}}
|
|
263
269
|
initialScrollIndex={this.currentScrollIndex}
|
|
264
270
|
getItemLayout={(data, index) =>
|
|
265
271
|
this.getItemLayout(data, index, size.width)
|
package/TabHeader.tsx
CHANGED
|
@@ -30,9 +30,7 @@ export default class TabHeader extends React.Component<
|
|
|
30
30
|
|
|
31
31
|
onChangeTab = () => {
|
|
32
32
|
const {onChangeTab, id} = this.props;
|
|
33
|
-
|
|
34
|
-
onChangeTab(id);
|
|
35
|
-
}
|
|
33
|
+
onChangeTab?.(id);
|
|
36
34
|
};
|
|
37
35
|
|
|
38
36
|
updateView = (date: Moment.Moment, activeTab: boolean) => {
|
package/index.tsx
CHANGED
|
@@ -88,9 +88,9 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
onChangeTab = (idTab: number) => {
|
|
91
|
-
this.props.onChangeTab
|
|
92
|
-
|
|
91
|
+
this.props.onChangeTab?.(idTab);
|
|
93
92
|
this.tabSelected = idTab;
|
|
93
|
+
|
|
94
94
|
if (this.cellHeader1.current && this.cellHeader2.current) {
|
|
95
95
|
this.cellHeader1.current.setActiveTab(idTab === 0);
|
|
96
96
|
this.cellHeader2.current.setActiveTab(idTab === 1);
|
|
@@ -183,9 +183,9 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
183
183
|
) {
|
|
184
184
|
this.doubleDate.second = this.selectedDate;
|
|
185
185
|
this.cellHeader2.current.updateView(this.selectedDate, false);
|
|
186
|
-
this.cellHeader1
|
|
186
|
+
this.cellHeader1?.current?.setActiveTab(true);
|
|
187
187
|
this.tabSelected = 0;
|
|
188
|
-
this.calendarPicker
|
|
188
|
+
this.calendarPicker?.current?.setDoubleDateAndTabIndex(
|
|
189
189
|
this.doubleDate.first,
|
|
190
190
|
this.doubleDate.second,
|
|
191
191
|
this.tabSelected,
|
|
@@ -205,8 +205,8 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
205
205
|
this.doubleDate.first = this.selectedDate;
|
|
206
206
|
this.doubleDate.second = null;
|
|
207
207
|
|
|
208
|
-
this.cellHeader1
|
|
209
|
-
this.cellHeader2
|
|
208
|
+
this.cellHeader1?.current?.updateView(this.selectedDate, false);
|
|
209
|
+
this.cellHeader2?.current?.updateView(null, false);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
|
package/package.json
CHANGED
package/types.ts
CHANGED