import { StyleSheet, Text, TextInput, View, type TextInputProps, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; import { useAppTheme } from "@/contexts/ThemeContext"; import { fonts, radii, spacing } from "@/constants/theme"; type InputProps = TextInputProps & { label: string; error?: string; required?: boolean; leftIcon?: keyof typeof Ionicons.glyphMap; labelAccessory?: React.ReactNode; hint?: string; }; export function Input({ label, error, required, leftIcon, labelAccessory, hint, style, ...props }: InputProps) { const { colors } = useAppTheme(); return ( {label} {required ? * : null} {labelAccessory} {leftIcon ? ( ) : null} {hint && !error ? ( {hint} ) : null} {error ? {error} : null} ); } const styles = StyleSheet.create({ wrapper: { gap: spacing.sm, }, labelRow: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", gap: spacing.sm, }, label: { fontSize: 14, fontFamily: fonts.bodyMedium, }, field: { position: "relative", justifyContent: "center", }, leftIcon: { position: "absolute", left: spacing.md, zIndex: 1, }, input: { minHeight: 44, borderWidth: 1, borderRadius: radii.md, paddingHorizontal: spacing.md, fontSize: 14, fontFamily: fonts.body, }, inputWithIcon: { paddingLeft: spacing.md + 24, }, hint: { fontSize: 12, fontFamily: fonts.body, }, error: { fontSize: 13, fontFamily: fonts.body, }, });