import { Ionicons } from "@expo/vector-icons"; import { Pressable, View } from "react-native"; import { Text } from "@/components/ui/Text"; import { colors, radii } from "@/lib/theme"; export function QtyStepper({ value, onChange, min = 1, max = 99, size = "md", }: { value: number; onChange: (n: number) => void; min?: number; max?: number; size?: "sm" | "md"; }) { const dim = size === "sm" ? 26 : 32; const iconSize = size === "sm" ? 14 : 17; const step = (delta: number) => { const next = Math.min(max, Math.max(min, value + delta)); if (next !== value) onChange(next); }; return ( step(-1)} disabled={value <= min} style={{ width: dim, height: dim, borderRadius: dim / 2, alignItems: "center", justifyContent: "center", backgroundColor: colors.surfaceAlt, }} > {value} step(1)} disabled={value >= max} style={{ width: dim, height: dim, borderRadius: dim / 2, alignItems: "center", justifyContent: "center", backgroundColor: value >= max ? colors.surfaceAlt : colors.brand, }} > = max ? colors.disabled : colors.ink} /> ); }