import { ComponentProps } from "react"; import { View } from "react-native"; import { useIOTheme } from "../../context"; import { IOListItemStyles, IOListItemVisualParams, IOSpacingScale } from "../../core"; import { useIOFontDynamicScale } from "../../utils/accessibility"; import { WithTestID } from "../../utils/types"; import { IOIcons, Icon } from "../icons"; import { H3, H6 } from "../typography"; type ValueProps = ComponentProps; type IconProps = | { iconName: IOIcons; iconColor?: ComponentProps["color"]; } | { iconName?: never; iconColor?: never }; export type ListItemAmount = WithTestID<{ label: string; valueElementProps?: ValueProps; valueString: string; // Accessibility accessibilityLabel?: string; }> & IconProps; const iconMargin: IOSpacingScale = 8; export const ListItemAmount = ({ label, iconName, iconColor, valueElementProps, valueString, accessibilityLabel, testID }: ListItemAmount) => { const theme = useIOTheme(); const { dynamicFontScale, spacingScaleMultiplier, hugeFontEnabled } = useIOFontDynamicScale(); const listItemAccessibilityLabel = accessibilityLabel || `${label}`; const itemInfoTextComponent = (
{label}
); return ( {iconName && !hugeFontEnabled && ( )} {itemInfoTextComponent}

{valueString}

); };