import React, { useState } from 'react'; import { View, Text, TextInput, TouchableOpacity } from 'react-native'; import { CustomInputProps } from './CustomInput.props'; import { getStyles } from './CustomInput.styles'; import { useAppTheme } from '@theme'; export const CustomInput: React.FC = ({ label, isPassword = false, rightActionText, onRightActionPress, error, secureTextEntry, style, leftElement, ...rest }) => { const { colors } = useAppTheme(); const styles = getStyles(colors); const [isSecure, setIsSecure] = useState(isPassword); return ( {label && ( {label} )} {leftElement && ( {leftElement} )} {isPassword && ( setIsSecure(!isSecure)} activeOpacity={0.7} > {isSecure ? 'Show' : 'Hide'} )} {rightActionText && onRightActionPress && ( {rightActionText} )} {error && {error}} ); };