@momo-kits/calendar 0.153.2 → 0.154.1-beta.1

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
@@ -3,7 +3,7 @@ import { Text as RNText, TouchableOpacity, View } from 'react-native';
3
3
  import {
4
4
  ApplicationContext,
5
5
  Colors,
6
- scaleSize,
6
+ useScaleSize,
7
7
  Spacing,
8
8
  Text,
9
9
  } from '@momo-kits/foundation';
@@ -35,6 +35,10 @@ const Day: React.FC<DayProps> = props => {
35
35
 
36
36
  const { theme } = useContext(ApplicationContext);
37
37
  const size = useContext(ContainerContext);
38
+ const scaledHeight = useScaleSize(48);
39
+ const scaledSpacing = useScaleSize(Spacing.XS);
40
+ const scaledFontSize = useScaleSize(8);
41
+ const scaledLineHeight = useScaleSize(12);
38
42
 
39
43
  const itemWidth = (size.width - Spacing.M) / 7;
40
44
  if (isEmpty || !date) {
@@ -106,7 +110,7 @@ const Day: React.FC<DayProps> = props => {
106
110
  paddingVertical: !!price ? Spacing.XS : Spacing.S,
107
111
  },
108
112
  (isStart || isEnd) && { backgroundColor: theme.colors.primary },
109
- !!price && { height: scaleSize(48) },
113
+ !!price && { height: scaledHeight },
110
114
  { height: size.height },
111
115
  ]}
112
116
  disabled={!(isValid && isInScope)}
@@ -114,13 +118,14 @@ const Day: React.FC<DayProps> = props => {
114
118
  >
115
119
  {lunarDate && showLunar && !!date && (
116
120
  <RNText
121
+ allowFontScaling={false}
117
122
  style={{
118
123
  position: 'absolute',
119
- top: scaleSize(Spacing.XS),
120
- right: scaleSize(Spacing.XS),
124
+ top: scaledSpacing,
125
+ right: scaledSpacing,
121
126
  color: lunarTextColor,
122
- fontSize: scaleSize(8),
123
- lineHeight: scaleSize(12),
127
+ fontSize: scaledFontSize,
128
+ lineHeight: scaledLineHeight,
124
129
  }}
125
130
  >
126
131
  {lunarDate.lunarDay === 1
package/Month.tsx CHANGED
@@ -2,7 +2,7 @@ import React, {useContext, useMemo} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import moment, {Moment} from 'moment';
4
4
  import Day from './Day';
5
- import {scaleSize, Spacing} from '@momo-kits/foundation';
5
+ import {useScaleSize, Spacing} from '@momo-kits/foundation';
6
6
  import {MonthProps} from './types';
7
7
  import {ContainerContext} from './index';
8
8
 
@@ -46,6 +46,7 @@ const Month: React.FC<MonthProps> = ({
46
46
  };
47
47
 
48
48
  const size = useContext(ContainerContext);
49
+ const scaledHeight = useScaleSize(48);
49
50
 
50
51
  // Precompute disabled dates set for fast lookup (format: YYYY-MM-DD)
51
52
  const disabledSet = useMemo(
@@ -72,7 +73,7 @@ const Month: React.FC<MonthProps> = ({
72
73
  flexDirection: 'row',
73
74
  alignItems: 'center',
74
75
  marginBottom: Spacing.XS,
75
- height: scaleSize(48),
76
+ height: scaledHeight,
76
77
  }}>
77
78
  {dayList.map((item, i) => {
78
79
  const {isEmpty, date: dateMoment, lunarDate} = item;
package/MonthList.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { scaleSize, Spacing } from '@momo-kits/foundation';
1
+ import { useScaleSize, Spacing } from '@momo-kits/foundation';
2
2
  import moment, { Moment } from 'moment';
3
3
  import React, {
4
4
  forwardRef,
@@ -38,6 +38,7 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
38
38
  } = props;
39
39
 
40
40
  const size = useContext(ContainerContext);
41
+ const scaledHeight48 = useScaleSize(48);
41
42
  const listRef = useRef<FlatList>(null);
42
43
  const currentKey = useRef<string | null>(null);
43
44
  const [heightStyle, setHeightStyle] = useState({});
@@ -128,7 +129,7 @@ const MonthList = forwardRef<MonthListRef, MonthListProps>((props, ref) => {
128
129
  try {
129
130
  setHeightStyle({
130
131
  height:
131
- (scaleSize(48) * item.dateList.length) / 7 +
132
+ (scaledHeight48 * item.dateList.length) / 7 +
132
133
  Spacing.L * 2 +
133
134
  Spacing.XS,
134
135
  });
package/index.tsx CHANGED
@@ -11,7 +11,7 @@ import moment from 'moment';
11
11
  import {
12
12
  ApplicationContext,
13
13
  Radius,
14
- scaleSize,
14
+ useScaleSize,
15
15
  Spacing,
16
16
  Switch,
17
17
  Text,
@@ -27,6 +27,8 @@ export const ContainerContext = createContext({ width: 0, height: 0 });
27
27
 
28
28
  const Calendar: React.FC<CalendarProps> = props => {
29
29
  const { translate, theme } = useContext(ApplicationContext);
30
+ const scaledHeight48 = useScaleSize(48);
31
+ const scaledHeight34 = useScaleSize(34);
30
32
 
31
33
  // derive defaults for date bounds
32
34
  const currentDate = new Date();
@@ -336,7 +338,7 @@ const Calendar: React.FC<CalendarProps> = props => {
336
338
  <ContainerContext.Provider
337
339
  value={{
338
340
  width: containerWidth,
339
- height: priceList ? scaleSize(48) : scaleSize(34),
341
+ height: priceList ? scaledHeight48 : scaledHeight34,
340
342
  }}
341
343
  >
342
344
  <View onLayout={onLayout} style={[style, styles.scrollView]}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/calendar",
3
- "version": "0.153.2",
3
+ "version": "0.154.1-beta.1",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "peerDependencies": {
package/styles.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import {StyleSheet} from 'react-native';
2
- import {Colors, Radius, scaleSize, Spacing} from '@momo-kits/foundation';
2
+ import {Colors, Radius, Spacing} from '@momo-kits/foundation';
3
3
 
4
4
  export default StyleSheet.create({
5
5
  //calendar
@@ -119,9 +119,4 @@ export default StyleSheet.create({
119
119
  marginBottom: 0,
120
120
  overflow: 'hidden',
121
121
  },
122
- lunarText: {
123
- fontSize: scaleSize(8),
124
- lineHeight: scaleSize(12),
125
- fontWeight: '500',
126
- },
127
122
  });