import React, { useState } from 'react'; import { Platform, Pressable, StyleSheet, StyleProp, TextInput, TextInputProps, View, ViewStyle, } from 'react-native'; import { AppIcon, type AppIconName } from './app-icon'; import { fonts, m3Colors, m3Shape, spacing } from '../theme/proulr-theme'; const webInputLock = Platform.OS === 'web' ? ({ WebkitTextFillColor: m3Colors.onSurface, caretColor: m3Colors.onSurface, } as object) : null; export function TextField( props: TextInputProps & { containerStyle?: StyleProp; focused?: boolean; inputRef?: React.Ref; }, ) { const { containerStyle, focused, inputRef, style, multiline, ...rest } = props; return ( ); } export function PasswordField( props: TextInputProps & { containerStyle?: StyleProp; inputRef?: React.Ref; }, ) { const { containerStyle, inputRef, ...rest } = props; const [visible, setVisible] = useState(false); return ( setVisible((v) => !v)} hitSlop={8} style={styles.passwordToggle} accessibilityLabel={visible ? 'Ocultar senha' : 'Mostrar senha'} accessibilityRole="button" > ); } const styles = StyleSheet.create({ field: { minHeight: 56, borderRadius: m3Shape.cornerExtraSmall, backgroundColor: 'transparent', borderWidth: 1, borderColor: m3Colors.outline, paddingHorizontal: spacing.sm, justifyContent: 'center', }, fieldMultiline: { minHeight: 128, justifyContent: 'flex-start', paddingVertical: spacing.md, }, fieldInput: { color: m3Colors.onSurface, fontSize: 16, fontFamily: fonts.regular }, fieldInputMultiline: { fontSize: 18, lineHeight: 26, minHeight: 96, width: '100%', }, passwordField: { flexDirection: 'row', alignItems: 'center', paddingRight: spacing.sm }, passwordInput: { flex: 1 }, passwordToggle: { width: 40, height: 40, alignItems: 'center', justifyContent: 'center', }, });