import { Text, TextInput, View } from 'react-native';

export const Field = ({
  label,
  value,
  onChangeText,
  placeholder,
  multiline = false,
  secureTextEntry = false,
  keyboardType,
}: {
  label: string;
  value: string;
  onChangeText: (value: string) => void;
  placeholder?: string;
  multiline?: boolean;
  secureTextEntry?: boolean;
  keyboardType?: 'default' | 'email-address' | 'url';
}) => (
  <View className='gap-2'>
    <Text className='text-foreground text-sm font-medium'>{label}</Text>
    <TextInput
      className='border-input text-foreground rounded-md border px-3 py-3'
      keyboardType={keyboardType}
      multiline={multiline}
      placeholder={placeholder}
      placeholderTextColor='#64748b'
      secureTextEntry={secureTextEntry}
      textAlignVertical={multiline ? 'top' : 'center'}
      value={value}
      onChangeText={onChangeText}
    />
  </View>
);
