Skip to content

Commit 2851c62

Browse files
fix(mobile): stack row details for larger accessibility text
1 parent bd7b5ad commit 2851c62

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎apps/mobile/src/components/ListRowLayout.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ReactNode } from "react";
2-
import { Platform, View } from "react-native";
2+
import { Platform, useWindowDimensions, View } from "react-native";
33

44
import { cn } from "../lib/cn";
55
import { AppText } from "./AppText";
@@ -22,6 +22,9 @@ export function ListRowLayout({
2222
disabled,
2323
accessory,
2424
}: ListRowContentProps & { readonly accessory?: ReactNode }) {
25+
const { fontScale } = useWindowDimensions();
26+
// Leave the label room to wrap at accessibility text sizes.
27+
const stackDetail = fontScale >= 1.5;
2528
return (
2629
<View
2730
className={cn(
@@ -46,8 +49,11 @@ export function ListRowLayout({
4649
{description ? (
4750
<AppText className="text-sm text-foreground-muted">{description}</AppText>
4851
) : null}
52+
{detail && stackDetail ? (
53+
<AppText className="text-sm text-foreground-muted">{detail}</AppText>
54+
) : null}
4955
</View>
50-
{detail ? (
56+
{detail && !stackDetail ? (
5157
<AppText
5258
className="max-w-[40%] shrink text-right text-sm text-foreground-muted"
5359
numberOfLines={1}

0 commit comments

Comments
 (0)