@widergy/mobile-ui 1.32.11 → 1.32.12

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.32.12](https://github.com/widergy/mobile-ui/compare/v1.32.11...v1.32.12) (2024-12-11)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [UGC-1038] text scaling adjustments ([#398](https://github.com/widergy/mobile-ui/issues/398)) ([368fb41](https://github.com/widergy/mobile-ui/commit/368fb4158f03c9f1cf5c7a105aa7074bceb1eac5))
7
+
1
8
  ## [1.32.11](https://github.com/widergy/mobile-ui/compare/v1.32.10...v1.32.11) (2024-12-06)
2
9
 
3
10
 
@@ -1,7 +1,7 @@
1
1
  import { COLOR_SHADES } from '../../constants/Palette';
2
2
  import { getDefaultColorShade } from '../../utils/styleUtils';
3
3
  import { IS_IOS } from '../../utils/platformUtils/constants';
4
- import { scale } from '../../utils/scaleUtils';
4
+ import { factorScale } from '../../utils/scaleUtils';
5
5
 
6
6
  import { LINE_HEIGHTS, VARIANTS_SIZES, WEIGHTS } from './constants';
7
7
  import { DEFAULT_PROPS } from './proptypes';
@@ -17,7 +17,8 @@ export const getFontFamily = (theme, weight) =>
17
17
  ? theme.fonts.fontFamily
18
18
  : theme.fonts?.customVariants?.[weight]?.fontFamily;
19
19
 
20
- export const getFontSize = variant => scale(VARIANTS_SIZES[variant] || VARIANTS_SIZES[DEFAULT_PROPS.variant]);
20
+ export const getFontSize = variant =>
21
+ factorScale(VARIANTS_SIZES[variant] || VARIANTS_SIZES[DEFAULT_PROPS.variant]);
21
22
 
22
23
  export const getFontWeight = weight => (IS_IOS ? WEIGHTS[weight] || WEIGHTS[DEFAULT_PROPS.weight] : null);
23
24
 
@@ -44,5 +45,5 @@ export const retrieveStyle = ({ colorTheme, field, shade, theme, variant, weight
44
45
  margin: 0,
45
46
  paddingVertical: 0,
46
47
  textAlignVertical: 'center',
47
- ...(LINE_HEIGHTS?.[variant] ? { lineHeight: scale(LINE_HEIGHTS[variant]) } : {})
48
+ ...(LINE_HEIGHTS?.[variant] ? { lineHeight: factorScale(LINE_HEIGHTS[variant]) } : {})
48
49
  });
@@ -1,3 +1,5 @@
1
1
  // Base Device Guidelines (~5in)
2
2
  export const GUIDELINES_BASE_WIDTH = 350;
3
3
  export const GUIDELINES_BASE_HEIGHT = 680;
4
+
5
+ export const SCALING_FACTOR = 0.7; // This value was determined by the UX team, please do not change it without prior consultation
@@ -1,6 +1,6 @@
1
1
  import { Dimensions } from 'react-native';
2
2
 
3
- import { GUIDELINES_BASE_HEIGHT, GUIDELINES_BASE_WIDTH } from '../constants';
3
+ import { GUIDELINES_BASE_HEIGHT, GUIDELINES_BASE_WIDTH, SCALING_FACTOR } from '../constants';
4
4
 
5
5
  export const { height: WINDOW_HEIGHT, width: WINDOW_WIDTH } = Dimensions.get('window');
6
6
 
@@ -32,7 +32,11 @@ export const verticalScale = size => (WINDOW_HEIGHT / GUIDELINES_BASE_HEIGHT) *
32
32
  */
33
33
  export const moderateVerticalScale = (size, factor = 0.5) => size + (verticalScale(size) - size) * factor;
34
34
 
35
- export const scale = size => Math.round((verticalScale(size) + horizontalScale(size)) / 2);
35
+ const factorVerticalScale = size => (WINDOW_HEIGHT / GUIDELINES_BASE_HEIGHT) ** SCALING_FACTOR * size;
36
+
37
+ const factorHorizontalScale = size => (WINDOW_WIDTH / GUIDELINES_BASE_WIDTH) ** SCALING_FACTOR * size;
38
+
39
+ export const factorScale = size => (factorVerticalScale(size) + factorHorizontalScale(size)) / 2;
36
40
 
37
41
  export default {
38
42
  horizontalScale,
@@ -41,5 +45,5 @@ export default {
41
45
  verticalScale,
42
46
  WINDOW_HEIGHT,
43
47
  WINDOW_WIDTH,
44
- scale
48
+ factorScale
45
49
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@widergy/mobile-ui",
3
3
  "description": "Widergy Mobile Components",
4
4
  "author": "widergy",
5
- "version": "1.32.11",
5
+ "version": "1.32.12",
6
6
  "repository": "https://github.com/widergy/mobile-ui.git",
7
7
  "main": "lib/index.js",
8
8
  "files": [