This commit is contained in:
2025-07-04 19:38:14 +05:00
parent 9425dde7b9
commit 6c15093ebc
2 changed files with 106 additions and 100 deletions

View File

@@ -11,6 +11,8 @@ import {
ScrollView, ScrollView,
TouchableWithoutFeedback, TouchableWithoutFeedback,
Keyboard, Keyboard,
KeyboardAvoidingView,
Platform,
} from 'react-native'; } from 'react-native';
import { Ionicons } from '@expo/vector-icons'; import { Ionicons } from '@expo/vector-icons';
import Input from './Input'; import Input from './Input';
@@ -199,113 +201,118 @@ const EditProfileModal = ({
onRequestClose={handleClose} onRequestClose={handleClose}
> >
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}> <KeyboardAvoidingView
<View style={styles.content}> behavior={Platform.OS === 'ios' ? 'padding' : undefined}
{/* Header */} style={{ flex: 1 }}
<View style={styles.header}> >
<TouchableOpacity onPress={handleClose} style={styles.closeButton}> <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<Ionicons name="close" size={24} color={COLORS.text} /> <View style={styles.content}>
</TouchableOpacity> {/* Header */}
<Text style={styles.title}>Şahsy maglumatlar</Text> <View style={styles.header}>
<View style={styles.placeholder} /> <TouchableOpacity onPress={handleClose} style={styles.closeButton}>
</View> <Ionicons name="close" size={24} color={COLORS.text} />
</TouchableOpacity>
{/* Form */} <Text style={styles.title}>Şahsy maglumatlar</Text>
<ScrollView style={styles.form} showsVerticalScrollIndicator={false}> <View style={styles.placeholder} />
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Esasy maglumatlar</Text>
<Input
label="Ady *"
value={formData.name}
onChangeText={(value) => updateFormData('name', value)}
error={errors.name}
maxLength={255}
returnKeyType="next"
onSubmitEditing={() => phoneInputRef.current?.focus()}
/>
<Input
ref={phoneInputRef}
label="Telefon belgisi *"
value={formData.phone}
onChangeText={(value) => updateFormData('phone', value)}
error={errors.phone}
keyboardType="numeric"
maxLength={8}
returnKeyType="next"
onSubmitEditing={() => passwordInputRef.current?.focus()}
/>
<Input
ref={passwordInputRef}
label="Täze parol"
value={formData.password}
onChangeText={(value) => updateFormData('password', value)}
error={errors.password}
secureTextEntry
placeholder="Parol üýtgetmezlik üçin boş goýuň"
returnKeyType="next"
onSubmitEditing={() => passportIdInputRef.current?.focus()}
/>
</View> </View>
<View style={styles.formSection}> {/* Form */}
<Text style={styles.sectionTitle}>Passport maglumatlary</Text> <ScrollView style={styles.form} showsVerticalScrollIndicator={false}>
<View style={styles.formSection}>
<View style={styles.inputContainer}> <Text style={styles.sectionTitle}>Esasy maglumatlar</Text>
<Text style={styles.label}>Passport seriýasy</Text>
<TouchableOpacity <Input
style={[styles.pickerButton, errors.passport_serie && styles.inputError]} label="Ady *"
onPress={() => setShowPassportPicker(true)} value={formData.name}
> onChangeText={(value) => updateFormData('name', value)}
<Text style={[styles.pickerButtonText, !formData.passport_serie && styles.placeholderText]}> error={errors.name}
{formData.passport_serie || 'Saýlaň'} maxLength={255}
</Text> returnKeyType="next"
<Ionicons name="chevron-down" size={20} color={COLORS.textSecondary} /> onSubmitEditing={() => phoneInputRef.current?.focus()}
</TouchableOpacity> />
{errors.passport_serie && (
<Text style={styles.errorText}>{errors.passport_serie}</Text> <Input
)} ref={phoneInputRef}
label="Telefon belgisi *"
value={formData.phone}
onChangeText={(value) => updateFormData('phone', value)}
error={errors.phone}
keyboardType="numeric"
maxLength={8}
returnKeyType="next"
onSubmitEditing={() => passwordInputRef.current?.focus()}
/>
<Input
ref={passwordInputRef}
label="Täze parol"
value={formData.password}
onChangeText={(value) => updateFormData('password', value)}
error={errors.password}
secureTextEntry
placeholder="Parol üýtgetmezlik üçin boş goýuň"
returnKeyType="next"
onSubmitEditing={() => passportIdInputRef.current?.focus()}
/>
</View> </View>
<Input <View style={styles.formSection}>
ref={passportIdInputRef} <Text style={styles.sectionTitle}>Passport maglumatlary</Text>
label="Passport ID"
value={formData.passport_id} <View style={styles.inputContainer}>
onChangeText={(value) => updateFormData('passport_id', value)} <Text style={styles.label}>Passport seriýasy</Text>
error={errors.passport_id} <TouchableOpacity
keyboardType="numeric" style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
returnKeyType="done" onPress={() => setShowPassportPicker(true)}
/> >
</View> <Text style={[styles.pickerButtonText, !formData.passport_serie && styles.placeholderText]}>
{formData.passport_serie || 'Saýlaň'}
</Text>
<Ionicons name="chevron-down" size={20} color={COLORS.textSecondary} />
</TouchableOpacity>
{errors.passport_serie && (
<Text style={styles.errorText}>{errors.passport_serie}</Text>
)}
</View>
<View style={styles.note}> <Input
<Ionicons name="information-circle" size={16} color={COLORS.textSecondary} /> ref={passportIdInputRef}
<Text style={styles.noteText}> label="Passport ID"
* belgisi bolan meýdanlar hökmany doldurulmaly value={formData.passport_id}
</Text> onChangeText={(value) => updateFormData('passport_id', value)}
</View> error={errors.passport_id}
</ScrollView> keyboardType="numeric"
returnKeyType="done"
/>
</View>
{/* Save Button */} <View style={styles.note}>
<View style={styles.footer}> <Ionicons name="information-circle" size={16} color={COLORS.textSecondary} />
<Button <Text style={styles.noteText}>
title="Ýatda sakla" * belgisi bolan meýdanlar hökmany doldurulmaly
onPress={handleSave} </Text>
disabled={isLoading} </View>
style={styles.saveButton} </ScrollView>
/>
{isLoading && ( {/* Save Button */}
<ActivityIndicator <View style={styles.footer}>
size="small" <Button
color={COLORS.primary} title="Ýatda sakla"
style={styles.loader} onPress={handleSave}
disabled={isLoading}
style={styles.saveButton}
/> />
)} {isLoading && (
<ActivityIndicator
size="small"
color={COLORS.primary}
style={styles.loader}
/>
)}
</View>
</View> </View>
</View> </TouchableWithoutFeedback>
</TouchableWithoutFeedback> </KeyboardAvoidingView>
{renderPassportSeriesPicker()} {renderPassportSeriesPicker()}
</SafeAreaView> </SafeAreaView>

View File

@@ -103,7 +103,6 @@ const styles = StyleSheet.create({
backgroundColor: COLORS.backgroundSecondary, backgroundColor: COLORS.backgroundSecondary,
}, },
header: { header: {
backgroundColor: COLORS.white,
paddingHorizontal: 24, paddingHorizontal: 24,
paddingTop: 16, paddingTop: 16,
paddingBottom: 24, paddingBottom: 24,