import React, { useState } from 'react'; import { TextInput, TextInputProps, StyleSheet, View, Text, TouchableOpacity, Platform } from 'react-native'; import { useThemeColor } from '@/hooks/use-theme-color'; import { Ionicons } from '@expo/vector-icons'; interface InputProps extends TextInputProps { label?: string; error?: string; type?: 'text' | 'email' | 'password'; showPasswordToggle?: boolean; } export const Input: React.FC = ({ label, error, type = 'text', showPasswordToggle = false, style, ...props }) => { const [showPassword, setShowPassword] = useState(false); const textColor = useThemeColor({}, 'text'); const backgroundColor = useThemeColor({}, 'inputBackgroundColor'); const borderColor = useThemeColor({}, 'inputBorderColor'); const errorColor = '#ef4444'; const placeholderColor = useThemeColor({}, 'inputPlaceholderColor'); const keyboardType = type === 'email' ? 'email-address' : 'default'; const secureTextEntry = type === 'password' && !showPassword; return ( {label && ( {label} )} {type === 'password' && showPasswordToggle && ( setShowPassword(!showPassword)} > )} {error && ( {error} )} ); }; const styles = StyleSheet.create({ container: { marginBottom: 16, }, label: { fontSize: 14, fontWeight: '500', marginBottom: 6, }, inputContainer: { position: 'relative', }, input: { height: 48, paddingHorizontal: 12, paddingRight: 44, borderWidth: 1, borderRadius: 8, fontSize: 16, }, passwordToggle: { position: 'absolute', right: 12, top: 13, }, error: { fontSize: 12, marginTop: 4, }, });