scroll bug fixed

This commit is contained in:
2025-07-10 23:34:57 +05:00
parent 3eb5442a14
commit 8f16f14796
2 changed files with 164 additions and 159 deletions

View File

@@ -167,6 +167,7 @@ const EditProfileModal = ({
card_number: initialData.card_number ? initialData.card_number.toString() : '',
});
setErrors({});
Keyboard.dismiss(); // Dismiss keyboard when modal closes
onClose();
};
@@ -256,164 +257,168 @@ const EditProfileModal = ({
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={{ flex: 1 }}
>
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.content}>
{/* Header */}
<View style={styles.header}>
<TouchableOpacity onPress={handleClose} style={styles.closeButton}>
<Ionicons name="close" size={24} color={COLORS.text} />
</TouchableOpacity>
<Text style={styles.title}>Şahsy maglumatlar</Text>
<View style={styles.placeholder} />
</View>
{/* Form */}
<ScrollView style={styles.form} showsVerticalScrollIndicator={false} keyboardShouldPersistTaps="handled" contentContainerStyle={{paddingBottom:80}}>
<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 style={styles.formSection}>
<Text style={styles.sectionTitle}>Passport maglumatlary</Text>
<View style={styles.inputContainer}>
<Text style={styles.label}>Passport seriýasy</Text>
<TouchableOpacity
style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
onPress={() => setShowPassportPicker(true)}
>
<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>
<Input
ref={passportIdInputRef}
label="Passport ID"
value={formData.passport_id}
onChangeText={(value) => updateFormData('passport_id', value)}
error={errors.passport_id}
keyboardType="numeric"
returnKeyType="next"
onSubmitEditing={() => cardNameInputRef.current?.focus()}
/>
</View>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Kart maglumatlary</Text>
<Input
ref={cardNameInputRef}
label="Kartdaky ady"
value={formData.card_name}
onChangeText={(value) => updateFormData('card_name', value)}
error={errors.card_name}
maxLength={255}
returnKeyType="next"
onSubmitEditing={() => cardNumberInputRef.current?.focus()}
/>
<Input
ref={cardNumberInputRef}
label="Kart belgisi"
value={formData.card_number}
onChangeText={(value) => updateFormData('card_number', value)}
error={errors.card_number}
keyboardType="numeric"
maxLength={16}
returnKeyType="next"
onSubmitEditing={() => cardMonthInputRef.current?.focus()}
/>
<Input
ref={cardMonthInputRef}
label="Kart aýy (MM)"
value={formData.card_month}
onChangeText={(value) => updateFormData('card_month', value)}
error={errors.card_month}
keyboardType="numeric"
maxLength={2}
returnKeyType="next"
onSubmitEditing={() => cardYearInputRef.current?.focus()}
/>
<Input
ref={cardYearInputRef}
label="Kartyň senesi (YYYY)"
value={formData.card_year}
onChangeText={(value) => updateFormData('card_year', value)}
error={errors.card_year}
keyboardType="numeric"
maxLength={4}
returnKeyType="done"
/>
</View>
<View style={styles.note}>
<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 style={styles.content}>
{/* Header */}
<View style={styles.header}>
<TouchableOpacity onPress={handleClose} style={styles.closeButton}>
<Ionicons name="close" size={24} color={COLORS.text} />
</TouchableOpacity>
<Text style={styles.title}>Şahsy maglumatlar</Text>
<View style={styles.placeholder} />
</View>
</TouchableWithoutFeedback>
{/* Form */}
<ScrollView
style={styles.form}
showsVerticalScrollIndicator={false}
keyboardShouldPersistTaps="handled"
contentContainerStyle={{paddingBottom:80}}
keyboardDismissMode="on-drag"
>
<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 style={styles.formSection}>
<Text style={styles.sectionTitle}>Passport maglumatlary</Text>
<View style={styles.inputContainer}>
<Text style={styles.label}>Passport seriýasy</Text>
<TouchableOpacity
style={[styles.pickerButton, errors.passport_serie && styles.inputError]}
onPress={() => setShowPassportPicker(true)}
>
<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>
<Input
ref={passportIdInputRef}
label="Passport ID"
value={formData.passport_id}
onChangeText={(value) => updateFormData('passport_id', value)}
error={errors.passport_id}
keyboardType="numeric"
returnKeyType="next"
onSubmitEditing={() => cardNameInputRef.current?.focus()}
/>
</View>
<View style={styles.formSection}>
<Text style={styles.sectionTitle}>Kart maglumatlary</Text>
<Input
ref={cardNameInputRef}
label="Kartdaky ady"
value={formData.card_name}
onChangeText={(value) => updateFormData('card_name', value)}
error={errors.card_name}
maxLength={255}
returnKeyType="next"
onSubmitEditing={() => cardNumberInputRef.current?.focus()}
/>
<Input
ref={cardNumberInputRef}
label="Kart belgisi"
value={formData.card_number}
onChangeText={(value) => updateFormData('card_number', value)}
error={errors.card_number}
keyboardType="numeric"
maxLength={16}
returnKeyType="next"
onSubmitEditing={() => cardMonthInputRef.current?.focus()}
/>
<Input
ref={cardMonthInputRef}
label="Kart aýy (MM)"
value={formData.card_month}
onChangeText={(value) => updateFormData('card_month', value)}
error={errors.card_month}
keyboardType="numeric"
maxLength={2}
returnKeyType="next"
onSubmitEditing={() => cardYearInputRef.current?.focus()}
/>
<Input
ref={cardYearInputRef}
label="Kartyň senesi (YYYY)"
value={formData.card_year}
onChangeText={(value) => updateFormData('card_year', value)}
error={errors.card_year}
keyboardType="numeric"
maxLength={4}
returnKeyType="done"
/>
</View>
<View style={styles.note}>
<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>
</KeyboardAvoidingView>
{renderPassportSeriesPicker()}

View File

@@ -7,8 +7,8 @@ import apiService from '../../services/apiService';
import { COLORS } from '../../constants/colors';
import { useBaseEnums } from '../../contexts/BaseEnumsContext';
const CARD_BG = '#EFF6FF';
const CIRCLE_BG = '#7FB3FF';
const CARD_BG = '#F1F9F1';
const CIRCLE_BG = '#A2E4A4';
const CardOrdersScreen = () => {
const navigation = useNavigation();