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}>
<Text style={styles.sectionTitle}>Esasy maglumatlar</Text>
<View style={styles.inputContainer}> <Input
<Text style={styles.label}>Passport seriýasy</Text> label="Ady *"
<TouchableOpacity value={formData.name}
style={[styles.pickerButton, errors.passport_serie && styles.inputError]} onChangeText={(value) => updateFormData('name', value)}
onPress={() => setShowPassportPicker(true)} error={errors.name}
> maxLength={255}
<Text style={[styles.pickerButtonText, !formData.passport_serie && styles.placeholderText]}> returnKeyType="next"
{formData.passport_serie || 'Saýlaň'} onSubmitEditing={() => phoneInputRef.current?.focus()}
</Text> />
<Ionicons name="chevron-down" size={20} color={COLORS.textSecondary} />
</TouchableOpacity> <Input
{errors.passport_serie && ( ref={phoneInputRef}
<Text style={styles.errorText}>{errors.passport_serie}</Text> 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}
onChangeText={(value) => updateFormData('passport_id', value)}
error={errors.passport_id}
keyboardType="numeric"
returnKeyType="done"
/>
</View>
<View style={styles.note}> <View style={styles.inputContainer}>
<Ionicons name="information-circle" size={16} color={COLORS.textSecondary} /> <Text style={styles.label}>Passport seriýasy</Text>
<Text style={styles.noteText}> <TouchableOpacity
* belgisi bolan meýdanlar hökmany doldurulmaly style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
</Text> onPress={() => setShowPassportPicker(true)}
</View> >
</ScrollView> <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>
{/* Save Button */} <Input
<View style={styles.footer}> ref={passportIdInputRef}
<Button label="Passport ID"
title="Ýatda sakla" value={formData.passport_id}
onPress={handleSave} onChangeText={(value) => updateFormData('passport_id', value)}
disabled={isLoading} error={errors.passport_id}
style={styles.saveButton} keyboardType="numeric"
/> returnKeyType="done"
{isLoading && ( />
<ActivityIndicator </View>
size="small"
color={COLORS.primary} <View style={styles.note}>
style={styles.loader} <Ionicons name="information-circle" size={16} color={COLORS.textSecondary} />
<Text style={styles.noteText}>
* belgisi bolan meýdanlar hökmany doldurulmaly
</Text>
</View>
</ScrollView>
{/* Save Button */}
<View style={styles.footer}>
<Button
title="Ýatda sakla"
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,