@momo-kits/foundation 0.160.1-beta.5 → 0.160.1-beta.6

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.
Files changed (2) hide show
  1. package/Text/utils.ts +11 -8
  2. package/package.json +1 -1
package/Text/utils.ts CHANGED
@@ -9,17 +9,20 @@ const MAX_FONT_SCALE = 1.2;
9
9
  const useScaleSize = (size: number) => {
10
10
  const { width } = useWindowDimensions();
11
11
  const context = useContext<any>(MiniAppContext);
12
- const allowFontScale = context?.designSystemConfig?.isBaselineEnabled;
13
- if (!allowFontScale) return size;
12
+ const allowFontScale = context?.designSystemConfig?.allowFontScale ?? true;
14
13
 
15
- const deviceScale = width / DEFAULT_SCREEN_SIZE;
16
- const fontScale = PixelRatio.getFontScale();
14
+ if (allowFontScale) {
15
+ const deviceScale = width / DEFAULT_SCREEN_SIZE;
16
+ const fontScale = PixelRatio.getFontScale();
17
17
 
18
- const maxSize = size * MAX_FONT_SCALE;
19
- const fontSizeScaleDevice = deviceScale > 1 ? deviceScale * size : size;
20
- const fontSizeScaleOS = fontScale > 1 ? fontScale * size : size;
18
+ const maxSize = size * MAX_FONT_SCALE;
19
+ const fontSizeScaleDevice = deviceScale > 1 ? deviceScale * size : size;
20
+ const fontSizeScaleOS = fontScale > 1 ? fontScale * size : size;
21
21
 
22
- return Math.min(Math.max(fontSizeScaleDevice, fontSizeScaleOS), maxSize);
22
+ return Math.min(Math.max(fontSizeScaleDevice, fontSizeScaleOS), maxSize);
23
+ }
24
+
25
+ return size;
23
26
  };
24
27
 
25
28
  const scaleSize = (size: number) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.160.1-beta.5",
3
+ "version": "0.160.1-beta.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},