@jobber/components-native 0.82.1-JOB-131123-08080a4.35 → 0.82.1-JOB-131123-e5eeb18.39

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.
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { NativeSyntheticEvent, StyleProp, TextLayoutEventData, TextProps, TextStyle } from "react-native";
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 = (event: NativeSyntheticEvent<TextLayoutEventData>) => void;
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-08080a4.35+08080a4f",
3
+ "version": "0.82.1-JOB-131123-e5eeb18.39+e5eeb18c",
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": "08080a4f21868bdc10bb527a25f48da3ab225339"
82
+ "gitHead": "e5eeb18c68dd0ac545e56ef87cd7ca8f1edac8e9"
83
83
  }
@@ -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="dashed">Test Text</Text>);
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
- const { getByRole } = render(
163
- <Text UNSAFE_style={customStyle}>Test Text</Text>,
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
- const { getByRole } = render(
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
  });
@@ -574,7 +574,7 @@ exports[`renders text with underline styling 1`] = `
574
574
  "letterSpacing": 0,
575
575
  },
576
576
  {
577
- "textDecorationStyle": "dashed",
577
+ "textDecorationStyle": "dotted",
578
578
  },
579
579
  {
580
580
  "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,
@@ -484,6 +482,4 @@ export type TruncateLength =
484
482
  | "extraLarge"
485
483
  | "unlimited";
486
484
 
487
- export type OnTextLayoutEvent = (
488
- event: NativeSyntheticEvent<TextLayoutEventData>,
489
- ) => void;
485
+ export type OnTextLayoutEvent = Exclude<TextProps["onTextLayout"], undefined>;