@momo-kits/foundation 0.159.1-beta.3 → 0.159.1-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.
@@ -376,7 +376,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
376
376
  return (
377
377
  <Text
378
378
  numberOfLines={1}
379
- maxScaleRate={1.4}
380
379
  typography={
381
380
  focused ? 'label_xs_medium' : 'description_xs_regular'
382
381
  }
package/Input/Input.tsx CHANGED
@@ -75,7 +75,7 @@ const Input = forwardRef(
75
75
  const { theme } = useContext(ApplicationContext);
76
76
  const context = useContext<any>(MiniAppContext);
77
77
  const scaledFontSize = useScaleSize(14);
78
- const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
78
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
79
79
  const [focused, setFocused] = useState(false);
80
80
  const haveValue = !!value || !!defaultValue;
81
81
  const inputRef = useRef<TextInput | null>(null);
@@ -40,7 +40,7 @@ const InputDropDown = ({
40
40
  }: InputDropDownProps) => {
41
41
  const { theme } = useContext(ApplicationContext);
42
42
  const context = useContext<any>(MiniAppContext);
43
- const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
43
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
44
44
  const componentName = 'InputDropDown';
45
45
 
46
46
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
@@ -67,7 +67,7 @@ const InputMoney = forwardRef(
67
67
  ) => {
68
68
  const { theme } = useContext(ApplicationContext);
69
69
  const context = useContext<any>(MiniAppContext);
70
- const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
70
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
71
71
  const scaledFontSize = useScaleSize(20);
72
72
  const [focused, setFocused] = useState(false);
73
73
  const [displayValue, setDisplayValue] = useState('');
@@ -67,7 +67,7 @@ const InputPhoneNumber = forwardRef(
67
67
  ) => {
68
68
  const { theme } = useContext(ApplicationContext);
69
69
  const context = useContext<any>(MiniAppContext);
70
- const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
70
+ const scaleHeight = useScaleSize(size === 'small' ? 48 : 56);
71
71
  const [focused, setFocused] = useState(false);
72
72
  const haveValue = !!value || !!defaultValue;
73
73
  const inputRef = useRef<TextInput | null>(null);
package/Text/index.tsx CHANGED
@@ -75,12 +75,6 @@ export interface TextProps extends RNTextProps {
75
75
  * Ex: MomoSignature, MomoTrustDisplay
76
76
  */
77
77
  fontFamily?: string;
78
-
79
- /**
80
- * Optional. Modified max scale rate of scaleSize function in Text component, default is 1.5.
81
- * Ex: 1.5, 2
82
- */
83
- maxScaleRate?: number;
84
78
  }
85
79
 
86
80
  const deprecatedValues: Typography[] = [
@@ -98,11 +92,7 @@ const deprecatedValues: Typography[] = [
98
92
  'action_s',
99
93
  ];
100
94
 
101
- const TypoStyles = (
102
- typo: Typography,
103
- newFontFamily?: string,
104
- maxScaleRate?: number,
105
- ) => {
95
+ const TypoStyles = (typo: Typography, newFontFamily?: string) => {
106
96
  const { theme } = useContext(ApplicationContext);
107
97
  const styleSheet: {
108
98
  [key: string]: any;
@@ -142,8 +132,8 @@ const TypoStyles = (
142
132
  return {
143
133
  ...typoStyle,
144
134
  fontFamily,
145
- fontSize: useScaleSize(fontSize, maxScaleRate),
146
- lineHeight: useScaleSize(lineHeight, maxScaleRate),
135
+ fontSize: useScaleSize(fontSize),
136
+ lineHeight: useScaleSize(lineHeight),
147
137
  fontStyle,
148
138
  fontWeight,
149
139
  };
@@ -155,13 +145,12 @@ const Text: React.FC<TextProps> = ({
155
145
  children,
156
146
  style,
157
147
  fontFamily,
158
- maxScaleRate,
159
148
  ...rest
160
149
  }) => {
161
150
  const { theme } = useContext(ApplicationContext);
162
151
  const context = useContext<any>(MiniAppContext);
163
152
  const skeleton = useContext(SkeletonContext);
164
- const textStyle = TypoStyles(typography, fontFamily, maxScaleRate);
153
+ const textStyle = TypoStyles(typography, fontFamily);
165
154
 
166
155
  if (deprecatedValues.includes(typography)) {
167
156
  console.warn(
package/Text/utils.ts CHANGED
@@ -7,56 +7,12 @@ const DEFAULT_SCREEN_SIZE = 375;
7
7
  const MAX_FONT_SCALE = 1.2;
8
8
  const MAX_DEVICE_SCALE = 5;
9
9
 
10
- const useScaleSize = (size: number, scaleRate?: number) => {
11
- const { scaleSizeMaxRate = MAX_FONT_SCALE } = useContext(ScaleSizeContext);
12
- const fontScale = PixelRatio.getFontScale();
13
- const { width } = useWindowDimensions();
14
- const deviceScale = width / DEFAULT_SCREEN_SIZE;
15
-
16
- const maxScaleRate = scaleRate ?? scaleSizeMaxRate;
17
-
18
- let fontSizeDeviceScale = size;
19
- let fontSizeOSScale = size;
20
-
21
- if (deviceScale > 1) {
22
- fontSizeDeviceScale = Math.min(
23
- fontSizeDeviceScale * deviceScale,
24
- fontSizeDeviceScale + MAX_DEVICE_SCALE,
25
- );
26
- }
27
-
28
- if (fontScale > 1) {
29
- fontSizeOSScale = Math.min(
30
- fontSizeOSScale * fontScale,
31
- fontSizeOSScale * maxScaleRate,
32
- );
33
- }
34
-
35
- return Math.max(fontSizeDeviceScale, fontSizeOSScale);
10
+ const useScaleSize = (size: number) => {
11
+ return size;
36
12
  };
37
13
 
38
14
  const scaleSize = (size: number) => {
39
- const fontScale = PixelRatio.getFontScale();
40
- const deviceScale = deviceWidth / DEFAULT_SCREEN_SIZE;
41
-
42
- let fontSizeDeviceScale = size;
43
- let fontSizeOSScale = size;
44
-
45
- if (deviceScale > 1) {
46
- fontSizeDeviceScale = Math.min(
47
- fontSizeDeviceScale * deviceScale,
48
- fontSizeDeviceScale + MAX_DEVICE_SCALE,
49
- );
50
- }
51
-
52
- if (fontScale > 1) {
53
- fontSizeOSScale = Math.min(
54
- fontSizeOSScale * fontScale,
55
- fontSizeOSScale * MAX_FONT_SCALE,
56
- );
57
- }
58
-
59
- return Math.max(fontSizeDeviceScale, fontSizeOSScale);
15
+ return size;
60
16
  };
61
17
 
62
18
  export { scaleSize, useScaleSize };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.159.1-beta.3",
3
+ "version": "0.159.1-beta.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},