@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 {
|
|
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 =>
|
|
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:
|
|
48
|
+
...(LINE_HEIGHTS?.[variant] ? { lineHeight: factorScale(LINE_HEIGHTS[variant]) } : {})
|
|
48
49
|
});
|
package/lib/utils/constants.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
48
|
+
factorScale
|
|
45
49
|
};
|
package/package.json
CHANGED