23 lines
658 B
TypeScript
23 lines
658 B
TypeScript
import { View, Text, TextInput, TextInputProps } from 'react-native';
|
|
|
|
interface InputProps extends TextInputProps {
|
|
label?: string;
|
|
error?: string;
|
|
}
|
|
|
|
export function Input({ label, error, ...props }: InputProps) {
|
|
return (
|
|
<View className="mb-4">
|
|
{label && <Text className="text-charcoal font-medium mb-1">{label}</Text>}
|
|
<TextInput
|
|
className={`border rounded-xl px-4 py-3 text-charcoal bg-white ${
|
|
error ? 'border-danger' : 'border-gray-200'
|
|
}`}
|
|
placeholderTextColor="#9CA3AF"
|
|
{...props}
|
|
/>
|
|
{error && <Text className="text-danger text-sm mt-1">{error}</Text>}
|
|
</View>
|
|
);
|
|
}
|