Refactor to new ThemedInput component

This commit is contained in:
Maarten 2024-08-13 09:17:19 +02:00
parent f3c5667f0a
commit 0bfb70af8b
7 changed files with 90 additions and 36 deletions

View file

@ -11,6 +11,7 @@ import { Colors } from '@/lib/constants/Colors';
import { ThemedView } from '@/lib/components/ThemedView';
import { ThemedText } from '@/lib/components/ThemedText';
import { useColorScheme } from '@/lib/hooks/useColorScheme';
import ThemedInput from '@/lib/components/ThemedInput';
interface Field {
name: string;
@ -59,17 +60,13 @@ const CustomModal: React.FC<EditModalProps> = ({ title, visible, onClose, onSave
<ThemedText style={styles.text}>{title ? title : t( "modal.default.title" )}</ThemedText>
{fields.map( (field, index) => (
<ThemedView key={index} style={styles.inputContainer}>
{field.title && <ThemedText style={styles.inputTitle}>{field.title}</ThemedText>}
<TextInput
style={[ styles.input, { color: Colors[ colorScheme ].text } ]}
placeholder={field.placeholder}
onChangeText={(text) => handleInputChange( field.name, text )}
value={inputValues[ field.name ] || ''}
placeholderTextColor={Colors[ colorScheme ].text}
/>
</ThemedView>
<ThemedInput
key={index}
label={field.title}
onChangeText={(text) => handleInputChange( field.name, text )}
value={inputValues[ field.name ] || ''}
placeholder={field.placeholder}
/>
) )}
<ThemedView style={styles.buttonContainer}>