import { Keyboard, Pressable, StyleSheet, Text, TextInput, View, } from 'react-native'; import {renderIcon} from '../../helpers/renderIcon'; import {useInput} from '../../hooks'; import {inputStyles} from '../../theme/inputStyles'; import type {inputProps} from '../../types'; export const Input = (props: inputProps) => { const { accessibilityHint, accessibilityLabel, autoComplete, borderColor, borderRadius, icon, iconColor, iconSize, keyboardType, label, labelColor, onChangeText, onEndEditing, password = false, placeholder, placeholderColor, rightIcon, rightIconColor, rightIconSize, search = false, style, testID, textColor, textContentType, textStyle, type = 'filled', value, } = props; const { getRightIcon, handleBlur, handleFocus, handlePress, inputStyle, passwordVisible, titleStyle, } = useInput(props); return ( {label && ( {type === 'outlined' && ( )} {label} {type === 'outlined' && ( )} )} {!!icon && ( {renderIcon(icon, {size: iconSize ?? 16, color: iconColor})} )} Keyboard.dismiss()} placeholder={placeholder ?? label ?? 'Input'} placeholderTextColor={placeholderColor} secureTextEntry={password ? !passwordVisible : false} textContentType={password ? 'password' : textContentType} value={value} /> {(password || search || rightIcon) && ( {renderIcon(getRightIcon(), { size: rightIconSize ?? 18, color: rightIconColor, })} )} ); }; const styles = StyleSheet.create({ wrapper: { width: '100%', }, row: { flexDirection: 'row', }, });