@jobber/components-native 0.82.1-JOB-131123-08080a4.35 → 0.82.1-JOB-131123-46bcb04.40
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/dist/package.json +2 -2
- package/dist/src/Typography/Typography.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Typography/Typography.d.ts +2 -2
- package/package.json +2 -2
- package/src/Heading/__snapshots__/Heading.test.tsx.snap +1 -0
- package/src/Text/Text.test.tsx +7 -38
- package/src/Text/__snapshots__/Text.test.tsx.snap +3 -1
- package/src/Typography/Typography.tsx +2 -5
- package/src/Typography/__snapshots__/Typography.test.tsx.snap +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StyleProp, TextProps, TextStyle } from "react-native";
|
|
3
3
|
export interface TypographyProps<T extends FontFamily> extends Pick<TextProps, "selectable"> {
|
|
4
4
|
/**
|
|
5
5
|
* Text capitalization
|
|
@@ -109,5 +109,5 @@ export type LineHeight = "extravagant" | "jumbo" | "largest" | "larger" | "large
|
|
|
109
109
|
export type LetterSpacing = "base" | "loose";
|
|
110
110
|
export type TextAccessibilityRole = "text" | "header";
|
|
111
111
|
export type TruncateLength = "single" | "small" | "base" | "large" | "extraLarge" | "unlimited";
|
|
112
|
-
export type OnTextLayoutEvent =
|
|
112
|
+
export type OnTextLayoutEvent = Exclude<TextProps["onTextLayout"], undefined>;
|
|
113
113
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.82.1-JOB-131123-
|
|
3
|
+
"version": "0.82.1-JOB-131123-46bcb04.40+46bcb041",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"react-native-safe-area-context": "^5.4.0",
|
|
80
80
|
"react-native-svg": ">=12.0.0"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "46bcb04157a11807031042ad5c1f9f7938ee3248"
|
|
83
83
|
}
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { fireEvent, render } from "@testing-library/react-native";
|
|
2
|
+
import { fireEvent, render, screen } from "@testing-library/react-native";
|
|
3
3
|
import { Text } from ".";
|
|
4
4
|
import { tokens } from "../utils/design";
|
|
5
5
|
|
|
@@ -135,6 +135,7 @@ it("renders with italic styling", () => {
|
|
|
135
135
|
|
|
136
136
|
it("renders text that is inaccessible", () => {
|
|
137
137
|
const text = render(<Text hideFromScreenReader={true}>Test Text</Text>);
|
|
138
|
+
|
|
138
139
|
expect(text.root.props).toEqual(
|
|
139
140
|
expect.objectContaining({
|
|
140
141
|
accessibilityRole: "none",
|
|
@@ -145,7 +146,7 @@ it("renders text that is inaccessible", () => {
|
|
|
145
146
|
});
|
|
146
147
|
|
|
147
148
|
it("renders text with underline styling", () => {
|
|
148
|
-
const text = render(<Text underline="
|
|
149
|
+
const text = render(<Text underline="dotted">Test Text</Text>);
|
|
149
150
|
|
|
150
151
|
expect(text.toJSON()).toMatchSnapshot();
|
|
151
152
|
});
|
|
@@ -159,10 +160,8 @@ describe("UNSAFE_style", () => {
|
|
|
159
160
|
},
|
|
160
161
|
};
|
|
161
162
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
);
|
|
165
|
-
const textElement = getByRole("text");
|
|
163
|
+
render(<Text UNSAFE_style={customStyle}>Test Text</Text>);
|
|
164
|
+
const textElement = screen.getByRole("text");
|
|
166
165
|
expect(textElement.props.style).toContainEqual(
|
|
167
166
|
expect.objectContaining(customStyle.textStyle),
|
|
168
167
|
);
|
|
@@ -172,11 +171,9 @@ describe("UNSAFE_style", () => {
|
|
|
172
171
|
describe("onTextLayout", () => {
|
|
173
172
|
it("calls onTextLayout callback when text layout event occurs", () => {
|
|
174
173
|
const onTextLayoutMock = jest.fn();
|
|
175
|
-
|
|
176
|
-
<Text onTextLayout={onTextLayoutMock}>Test Text</Text>,
|
|
177
|
-
);
|
|
174
|
+
render(<Text onTextLayout={onTextLayoutMock}>Test Text</Text>);
|
|
178
175
|
|
|
179
|
-
const textElement = getByRole("text");
|
|
176
|
+
const textElement = screen.getByRole("text");
|
|
180
177
|
const mockEvent = {
|
|
181
178
|
nativeEvent: {
|
|
182
179
|
lines: [
|
|
@@ -198,32 +195,4 @@ describe("onTextLayout", () => {
|
|
|
198
195
|
expect(onTextLayoutMock).toHaveBeenCalledTimes(1);
|
|
199
196
|
expect(onTextLayoutMock).toHaveBeenCalledWith(mockEvent);
|
|
200
197
|
});
|
|
201
|
-
|
|
202
|
-
it("does not call onTextLayout when prop is not provided", () => {
|
|
203
|
-
const { getByRole } = render(<Text>Test Text</Text>);
|
|
204
|
-
|
|
205
|
-
const textElement = getByRole("text");
|
|
206
|
-
const mockEvent = {
|
|
207
|
-
nativeEvent: {
|
|
208
|
-
lines: [
|
|
209
|
-
{
|
|
210
|
-
text: "Test Text",
|
|
211
|
-
x: 0,
|
|
212
|
-
y: 0,
|
|
213
|
-
width: 100,
|
|
214
|
-
height: 20,
|
|
215
|
-
ascender: 15,
|
|
216
|
-
descender: -5,
|
|
217
|
-
capHeight: 14,
|
|
218
|
-
xHeight: 10,
|
|
219
|
-
},
|
|
220
|
-
],
|
|
221
|
-
},
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// This should not throw an error
|
|
225
|
-
expect(() => {
|
|
226
|
-
fireEvent(textElement, "onTextLayout", mockEvent);
|
|
227
|
-
}).not.toThrow();
|
|
228
|
-
});
|
|
229
198
|
});
|
|
@@ -108,6 +108,7 @@ exports[`renders text that is not scaled down with adjustsFontSize false 1`] = `
|
|
|
108
108
|
adjustsFontSizeToFit={false}
|
|
109
109
|
allowFontScaling={true}
|
|
110
110
|
collapsable={false}
|
|
111
|
+
ellipsizeMode="tail"
|
|
111
112
|
maxFontSizeMultiplier={3.125}
|
|
112
113
|
numberOfLines={4}
|
|
113
114
|
selectable={true}
|
|
@@ -143,6 +144,7 @@ exports[`renders text that is scaled down with adjustsFontSize true 1`] = `
|
|
|
143
144
|
adjustsFontSizeToFit={true}
|
|
144
145
|
allowFontScaling={true}
|
|
145
146
|
collapsable={false}
|
|
147
|
+
ellipsizeMode="tail"
|
|
146
148
|
maxFontSizeMultiplier={3.125}
|
|
147
149
|
numberOfLines={4}
|
|
148
150
|
selectable={true}
|
|
@@ -574,7 +576,7 @@ exports[`renders text with underline styling 1`] = `
|
|
|
574
576
|
"letterSpacing": 0,
|
|
575
577
|
},
|
|
576
578
|
{
|
|
577
|
-
"textDecorationStyle": "
|
|
579
|
+
"textDecorationStyle": "dotted",
|
|
578
580
|
},
|
|
579
581
|
{
|
|
580
582
|
"textDecorationColor": "hsl(197, 15%, 43%)",
|
|
@@ -2,11 +2,9 @@ import React from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
AccessibilityProps,
|
|
4
4
|
I18nManager,
|
|
5
|
-
NativeSyntheticEvent,
|
|
6
5
|
StyleProp,
|
|
7
6
|
StyleSheet,
|
|
8
7
|
Text,
|
|
9
|
-
TextLayoutEventData,
|
|
10
8
|
TextProps,
|
|
11
9
|
TextStyle,
|
|
12
10
|
ViewStyle,
|
|
@@ -214,6 +212,7 @@ function InternalTypography<T extends FontFamily = "base">({
|
|
|
214
212
|
adjustsFontSizeToFit,
|
|
215
213
|
style,
|
|
216
214
|
numberOfLines: numberOfLinesForNativeText,
|
|
215
|
+
ellipsizeMode: numberOfLinesForNativeText ? "tail" : undefined,
|
|
217
216
|
}}
|
|
218
217
|
{...accessibilityProps}
|
|
219
218
|
maxFontSizeMultiplier={getScaleMultiplier(
|
|
@@ -484,6 +483,4 @@ export type TruncateLength =
|
|
|
484
483
|
| "extraLarge"
|
|
485
484
|
| "unlimited";
|
|
486
485
|
|
|
487
|
-
export type OnTextLayoutEvent =
|
|
488
|
-
event: NativeSyntheticEvent<TextLayoutEventData>,
|
|
489
|
-
) => void;
|
|
486
|
+
export type OnTextLayoutEvent = Exclude<TextProps["onTextLayout"], undefined>;
|
|
@@ -39,6 +39,7 @@ exports[`renders text using the maxLines is also passed 1`] = `
|
|
|
39
39
|
adjustsFontSizeToFit={false}
|
|
40
40
|
allowFontScaling={true}
|
|
41
41
|
collapsable={false}
|
|
42
|
+
ellipsizeMode="tail"
|
|
42
43
|
numberOfLines={2}
|
|
43
44
|
selectable={true}
|
|
44
45
|
selectionColor="hsl(86, 100%, 46%)"
|
|
@@ -73,6 +74,7 @@ exports[`renders text with adjustsFontSizeToFit set to true 1`] = `
|
|
|
73
74
|
adjustsFontSizeToFit={true}
|
|
74
75
|
allowFontScaling={true}
|
|
75
76
|
collapsable={false}
|
|
77
|
+
ellipsizeMode="tail"
|
|
76
78
|
numberOfLines={1}
|
|
77
79
|
selectable={true}
|
|
78
80
|
selectionColor="hsl(86, 100%, 46%)"
|