@applicaster/zapp-react-native-ui-components 15.0.0-rc.125 → 15.0.0-rc.126
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.
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
dateFormat,
|
|
7
7
|
} from "@applicaster/zapp-react-native-utils/cellUtils";
|
|
8
8
|
|
|
9
|
-
import { useTextLabel
|
|
10
|
-
import { withScaledLineHeight } from "./utils";
|
|
9
|
+
import { useTextLabel } from "./hooks";
|
|
11
10
|
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
12
11
|
import { MeasurementPortalContext } from "../../../MeasurmentsPortal";
|
|
13
12
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
@@ -70,12 +69,9 @@ const _Text = ({
|
|
|
70
69
|
|
|
71
70
|
return (
|
|
72
71
|
<Text
|
|
73
|
-
style={[
|
|
74
|
-
withScaledLineHeight(withFocusedStyles({ style, otherProps })),
|
|
75
|
-
{ height },
|
|
76
|
-
]}
|
|
77
|
-
allowFontScaling={false}
|
|
72
|
+
style={[style, { height }]}
|
|
78
73
|
{...withoutLabel(otherProps)}
|
|
74
|
+
allowFontScaling={false}
|
|
79
75
|
>
|
|
80
76
|
{textLabel}
|
|
81
77
|
</Text>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.126",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "15.0.0-rc.
|
|
32
|
-
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-react-native-redux": "15.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-utils": "15.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "15.0.0-rc.126",
|
|
32
|
+
"@applicaster/zapp-react-native-bridge": "15.0.0-rc.126",
|
|
33
|
+
"@applicaster/zapp-react-native-redux": "15.0.0-rc.126",
|
|
34
|
+
"@applicaster/zapp-react-native-utils": "15.0.0-rc.126",
|
|
35
35
|
"fast-json-stable-stringify": "^2.1.0",
|
|
36
36
|
"promise": "^8.3.0",
|
|
37
37
|
"url": "^0.11.0",
|
package/Components/MasterCell/DefaultComponents/Text/utils/__tests__/withAdjustedLineHeight.test.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { PixelRatio } from "react-native";
|
|
2
|
-
import { withAdjustedLineHeight } from "..";
|
|
3
|
-
|
|
4
|
-
const FONT_SCALE = 1.118;
|
|
5
|
-
jest.spyOn(PixelRatio, "getFontScale").mockReturnValue(FONT_SCALE);
|
|
6
|
-
|
|
7
|
-
describe("withAdjustedLineHeight", () => {
|
|
8
|
-
it("with provided fontScale and styles", () => {
|
|
9
|
-
// setup
|
|
10
|
-
const styles = {
|
|
11
|
-
lineHeight: 10,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// run
|
|
15
|
-
const result = withAdjustedLineHeight(styles);
|
|
16
|
-
|
|
17
|
-
// verify
|
|
18
|
-
expect(result).toEqual({
|
|
19
|
-
lineHeight: styles.lineHeight * FONT_SCALE,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("with provided fontScale and empty styles", () => {
|
|
24
|
-
// setup
|
|
25
|
-
const styles = {};
|
|
26
|
-
|
|
27
|
-
// run
|
|
28
|
-
const result = withAdjustedLineHeight(styles);
|
|
29
|
-
|
|
30
|
-
// verify
|
|
31
|
-
expect(result).toEqual(styles);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("with non-number lineHeight", () => {
|
|
35
|
-
// setup
|
|
36
|
-
const styles = {
|
|
37
|
-
lineHeight: NaN,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// run
|
|
41
|
-
const result = withAdjustedLineHeight(styles);
|
|
42
|
-
|
|
43
|
-
// verify
|
|
44
|
-
expect(result).toEqual(styles);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PixelRatio } from "react-native";
|
|
2
|
-
import { isNil, identity } from "ramda";
|
|
3
|
-
import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
|
-
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
5
|
-
|
|
6
|
-
// HACK - to prevent text flickering
|
|
7
|
-
export const withAdjustedLineHeight = (styles) => {
|
|
8
|
-
const fontScale = PixelRatio.getFontScale();
|
|
9
|
-
const lineHeight = toNumber(styles.lineHeight);
|
|
10
|
-
|
|
11
|
-
if (isNil(lineHeight)) {
|
|
12
|
-
return styles;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return { ...styles, lineHeight: lineHeight * fontScale };
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const withScaledLineHeight = platformSelect({
|
|
19
|
-
ios: withAdjustedLineHeight,
|
|
20
|
-
default: identity,
|
|
21
|
-
});
|