import React, { forwardRef, useState } from 'react'; import { StyleSheet, Text, TextInput, type TextInputProps, View, } from 'react-native'; import { Colors, Radius, Spacing, Typography } from '@/constants/theme'; interface InputProps extends TextInputProps { label: string; error?: string; hint?: string; prefix?: string; } export const Input = forwardRef(function Input( { label, error, hint, prefix, style, ...rest }, ref, ) { const [focused, setFocused] = useState(false); return ( {label} {prefix ? {prefix} : null} setFocused(true)} onBlur={() => setFocused(false)} selectionColor={Colors.primaryLight} {...rest} /> {error ? ( {error} ) : hint ? ( {hint} ) : null} ); }); const styles = StyleSheet.create({ wrapper: { gap: Spacing.xs, }, label: { ...Typography.caption, color: Colors.textSecondary, textTransform: 'uppercase', letterSpacing: 1, }, inputRow: { flexDirection: 'row', alignItems: 'center', backgroundColor: Colors.surfaceElevated, borderRadius: Radius.md, borderWidth: 1, borderColor: Colors.border, paddingHorizontal: Spacing.md, height: 52, }, inputRowFocused: { borderColor: Colors.primaryLight, }, inputRowError: { borderColor: Colors.negative, }, prefix: { ...Typography.bodyLarge, color: Colors.textSecondary, marginRight: Spacing.sm, }, input: { flex: 1, ...Typography.bodyLarge, color: Colors.textPrimary, }, error: { ...Typography.caption, color: Colors.negative, }, hint: { ...Typography.caption, color: Colors.textMuted, }, });