@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 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
- initialNumToRender={1}
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
- if (onChangeTab) {
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 && this.props.onChangeTab(idTab);
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.current?.setActiveTab(true);
186
+ this.cellHeader1?.current?.setActiveTab(true);
187
187
  this.tabSelected = 0;
188
- this.calendarPicker.current?.setDoubleDateAndTabIndex(
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.current?.updateView(this.selectedDate, false);
209
- this.cellHeader2.current?.updateView(null, false);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/calendar",
3
- "version": "0.79.6-beta.3",
3
+ "version": "0.79.6-beta.4",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
package/types.ts CHANGED
@@ -72,7 +72,7 @@ export type CalendarProps = {
72
72
  isOffLunar?: boolean;
73
73
  isHideHoliday?: boolean;
74
74
  isHiddenSwitch?: boolean;
75
- isShowLunar?: boolean;
75
+ isShowLunar: boolean;
76
76
  priceList?: PriceListData;
77
77
  labelFrom?: string;
78
78
  labelTo?: string;