@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/dist/package.json +2 -2
- package/dist/src/Select/Select.js +2 -2
- package/dist/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.js +2 -1
- package/dist/src/Typography/Typography.js +10 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Select/Select.tsx +2 -0
- package/src/Select/components/SelectDefaultPicker/SelectDefaultPicker.tsx +1 -1
- package/src/Text/Text.test.tsx +23 -0
- package/src/Typography/Typography.test.tsx +27 -0
- package/src/Typography/Typography.tsx +27 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.84.1
|
|
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": "
|
|
82
|
+
"gitHead": "071a5fbd1c5fd31ac6ad2c45ac297b4d51fbf999"
|
|
83
83
|
}
|
package/src/Select/Select.tsx
CHANGED
|
@@ -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>
|
package/src/Text/Text.test.tsx
CHANGED
|
@@ -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
|
-
|
|
221
|
-
<
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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) {
|