import { useState } from "react"; import { Platform, NativeSyntheticEvent, TextInputSubmitEditingEventData, } from "react-native"; import { TextInput, TextInputProps } from "react-native-paper"; interface PasswordInputProps { label: string; value: string; onChangeText: (text: string) => void; onBlur?: () => void; disabled?: boolean; style?: any; onSubmitEditing?: ( e?: NativeSyntheticEvent ) => void; returnKeyType?: any; submitBehavior?: TextInputProps["submitBehavior"]; } export const PasswordInput = ({ label, value, onChangeText, onBlur, disabled = false, style = {}, onSubmitEditing, returnKeyType, submitBehavior, }: PasswordInputProps) => { const [secureTextEntry, setSecureTextEntry] = useState(true); return ( { if (Platform.OS === "web" && e?.nativeEvent?.key === "Enter") { onSubmitEditing?.(); } }} left={} right={ setSecureTextEntry(!secureTextEntry)} /> } theme={{ colors: { primary: "#6750a4" } }} disabled={disabled} placeholderTextColor="#d9d9d9" /> ); };