@jobber/components-native 0.84.1-JOB-131539-aa42e78.8 → 0.84.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components-native",
3
- "version": "0.84.1-JOB-131539-aa42e78.8+aa42e786",
3
+ "version": "0.84.1",
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": "aa42e7869a6ef4352d1f35e348f11ef95c53df0c"
82
+ "gitHead": "071a5fbd1c5fd31ac6ad2c45ac297b4d51fbf999"
83
83
  }
@@ -158,6 +158,7 @@ export function Select({
158
158
  level="textSupporting"
159
159
  variation={textVariation}
160
160
  hideFromScreenReader={true}
161
+ selectable={false}
161
162
  >
162
163
  {label}
163
164
  </Text>
@@ -167,6 +168,7 @@ export function Select({
167
168
  <Text
168
169
  variation={disabled ? "disabled" : "base"}
169
170
  hideFromScreenReader={true}
171
+ selectable={false}
170
172
  >
171
173
  {getValue()}
172
174
  </Text>
@@ -18,7 +18,7 @@ export function SelectDefaultPicker({
18
18
  const { tokens } = useAtlantisTheme();
19
19
 
20
20
  return (
21
- <SelectPressable onPress={() => pickerRef.current?.focus()}>
21
+ <SelectPressable onPress={pickerRef.current?.focus}>
22
22
  {children}
23
23
  <Picker
24
24
  ref={pickerRef}
@@ -196,3 +196,26 @@ describe("onTextLayout", () => {
196
196
  expect(onTextLayoutMock).toHaveBeenCalledWith(mockEvent);
197
197
  });
198
198
  });
199
+
200
+ describe("TypographyGestureDetector", () => {
201
+ it("wraps text with TypographyGestureDetector by default (collapsable=false)", () => {
202
+ const { getByRole } = render(<Text>Test Text</Text>);
203
+ const textElement = getByRole("text");
204
+
205
+ expect(textElement.props.collapsable).toBe(false);
206
+ });
207
+
208
+ it("wraps text with TypographyGestureDetector (collapsable=false) when selectable=true", () => {
209
+ const { getByRole } = render(<Text selectable={true}>Test Text</Text>);
210
+ const textElement = getByRole("text");
211
+
212
+ expect(textElement.props.collapsable).toBe(false);
213
+ });
214
+
215
+ it("does not wrap text with TypographyGestureDetector when selectable=false", () => {
216
+ const { getByRole } = render(<Text selectable={false}>Test Text</Text>);
217
+ const textElement = getByRole("text");
218
+
219
+ expect(textElement.props.collapsable).toBeUndefined();
220
+ });
221
+ });
@@ -282,3 +282,30 @@ describe("onTextLayout", () => {
282
282
  expect(onTextLayoutMock).toHaveBeenCalledWith(mockEvent);
283
283
  });
284
284
  });
285
+
286
+ describe("TypographyGestureDetector", () => {
287
+ it("wraps text with TypographyGestureDetector by default (collapsable=false)", () => {
288
+ const { getByRole } = render(<Typography>Test Text</Typography>);
289
+ const textElement = getByRole("text");
290
+
291
+ expect(textElement.props.collapsable).toBe(false);
292
+ });
293
+
294
+ it("wraps text with TypographyGestureDetector (collapsable=false) when selectable=true", () => {
295
+ const { getByRole } = render(
296
+ <Typography selectable={true}>Test Text</Typography>,
297
+ );
298
+ const textElement = getByRole("text");
299
+
300
+ expect(textElement.props.collapsable).toBe(false);
301
+ });
302
+
303
+ it("does not wrap text with TypographyGestureDetector when selectable=false", () => {
304
+ const { getByRole } = render(
305
+ <Typography selectable={false}>Test Text</Typography>,
306
+ );
307
+ const textElement = getByRole("text");
308
+
309
+ expect(textElement.props.collapsable).toBeUndefined();
310
+ });
311
+ });
@@ -217,28 +217,34 @@ function InternalTypography<T extends FontFamily = "base">({
217
217
 
218
218
  const { tokens } = useAtlantisTheme();
219
219
 
220
- return (
221
- <TypographyGestureDetector>
222
- <Text
223
- {...{
224
- allowFontScaling,
225
- adjustsFontSizeToFit,
226
- style,
227
- numberOfLines: numberOfLinesForNativeText,
228
- }}
229
- {...accessibilityProps}
230
- maxFontSizeMultiplier={getScaleMultiplier(
231
- maxFontScaleSize,
232
- sizeAndHeight.fontSize,
233
- )}
234
- selectable={selectable}
235
- selectionColor={tokens["color-brand--highlight"]}
236
- onTextLayout={onTextLayout}
237
- >
238
- {text}
239
- </Text>
240
- </TypographyGestureDetector>
220
+ const textComponent = (
221
+ <Text
222
+ {...{
223
+ allowFontScaling,
224
+ adjustsFontSizeToFit,
225
+ style,
226
+ numberOfLines: numberOfLinesForNativeText,
227
+ }}
228
+ {...accessibilityProps}
229
+ maxFontSizeMultiplier={getScaleMultiplier(
230
+ maxFontScaleSize,
231
+ sizeAndHeight.fontSize,
232
+ )}
233
+ selectable={selectable}
234
+ selectionColor={tokens["color-brand--highlight"]}
235
+ onTextLayout={onTextLayout}
236
+ >
237
+ {text}
238
+ </Text>
241
239
  );
240
+
241
+ // If text is not selectable, there's no need for TypographyGestureDetector
242
+ // since it only prevents accidental highlighting of selectable text
243
+ if (!selectable) {
244
+ return textComponent;
245
+ }
246
+
247
+ return <TypographyGestureDetector>{textComponent}</TypographyGestureDetector>;
242
248
  }
243
249
 
244
250
  function getScaleMultiplier(maxFontScaleSize = 0, size = 1) {