keyboard scroll

This commit is contained in:
Samandar Turgunboyev
2026-03-02 15:46:12 +05:00
parent 4d5cc84850
commit c71651ec4b
2 changed files with 216 additions and 209 deletions

View File

@@ -25,15 +25,16 @@ import React, { useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
ActivityIndicator, ActivityIndicator,
KeyboardAvoidingView, Keyboard,
Platform,
ScrollView, ScrollView,
StyleSheet, StyleSheet,
Text, Text,
TextInput, TextInput,
TouchableOpacity, TouchableOpacity,
View, TouchableWithoutFeedback,
View
} from 'react-native'; } from 'react-native';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import { auth_api } from '../login/lib/api'; import { auth_api } from '../login/lib/api';
import PhonePrefix from '../login/ui/PhonePrefix'; import PhonePrefix from '../login/ui/PhonePrefix';
@@ -360,10 +361,13 @@ export default function RegisterFormScreen() {
}; };
return ( return (
<KeyboardAvoidingView <KeyboardAwareScrollView
behavior="padding" showsVerticalScrollIndicator={false}
style={{ flex: 1 }} keyboardShouldPersistTaps="handled"
enableOnAndroid
extraScrollHeight={120}
> >
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<View style={styles.container}> <View style={styles.container}>
<LinearGradient <LinearGradient
colors={['#0f172a', '#1e293b', '#334155']} colors={['#0f172a', '#1e293b', '#334155']}
@@ -377,10 +381,7 @@ export default function RegisterFormScreen() {
<AuthHeader /> <AuthHeader />
<SafeAreaView style={{ flex: 1 }} edges={['bottom']}> <SafeAreaView style={{ flex: 1 }} edges={['bottom']}>
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
>
<ScrollView <ScrollView
contentContainerStyle={styles.scrollContent} contentContainerStyle={styles.scrollContent}
showsVerticalScrollIndicator={false} showsVerticalScrollIndicator={false}
@@ -647,7 +648,6 @@ export default function RegisterFormScreen() {
</View> </View>
</View> </View>
</ScrollView> </ScrollView>
</KeyboardAvoidingView>
</SafeAreaView> </SafeAreaView>
{/* ---- Country BottomSheet ---- */} {/* ---- Country BottomSheet ---- */}
@@ -730,7 +730,8 @@ export default function RegisterFormScreen() {
/> />
</BottomSheet> </BottomSheet>
</View> </View>
</KeyboardAvoidingView> </TouchableWithoutFeedback>
</KeyboardAwareScrollView>
); );
} }

View File

@@ -1,5 +1,5 @@
import { useTheme } from '@/components/ThemeContext'; import { useTheme } from '@/components/ThemeContext';
import { BottomSheetBackdrop, BottomSheetModal, BottomSheetScrollView } from '@gorhom/bottom-sheet'; import { BottomSheetBackdrop, BottomSheetModal, BottomSheetScrollView, TouchableWithoutFeedback } from '@gorhom/bottom-sheet';
import { useMutation, useQuery } from '@tanstack/react-query'; import { useMutation, useQuery } from '@tanstack/react-query';
import { AxiosError } from 'axios'; import { AxiosError } from 'axios';
import { router, useFocusEffect } from 'expo-router'; import { router, useFocusEffect } from 'expo-router';
@@ -7,18 +7,19 @@ import React, { useCallback, useRef, useState } from 'react';
import { import {
Alert, Alert,
Image, Image,
KeyboardAvoidingView, Keyboard,
Linking, Linking,
ScrollView, ScrollView,
StyleSheet, StyleSheet,
Text, Text,
TouchableOpacity, TouchableOpacity,
View, View
} from 'react-native'; } from 'react-native';
import OneClick from '@/assets/images/one_click.png'; import OneClick from '@/assets/images/one_click.png';
import PAYME from '@/assets/images/Payme_NEW.png'; import PAYME from '@/assets/images/Payme_NEW.png';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import { price_calculation } from '../lib/api'; import { price_calculation } from '../lib/api';
import { CreateAdsResponse } from '../lib/types'; import { CreateAdsResponse } from '../lib/types';
import StepFour from './StepFour'; import StepFour from './StepFour';
@@ -209,10 +210,14 @@ export default function CreateAdsScreens() {
}; };
return ( return (
<KeyboardAvoidingView <KeyboardAwareScrollView
behavior="padding" showsVerticalScrollIndicator={false}
keyboardShouldPersistTaps="handled"
enableOnAndroid
extraScrollHeight={120}
style={[styles.safeArea, isDark ? styles.darkBg : styles.lightBg]} style={[styles.safeArea, isDark ? styles.darkBg : styles.lightBg]}
> >
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
<ScrollView contentContainerStyle={[styles.container, { paddingBottom: 90 }]}> <ScrollView contentContainerStyle={[styles.container, { paddingBottom: 90 }]}>
<Image <Image
source={OneClick} source={OneClick}
@@ -324,7 +329,8 @@ export default function CreateAdsScreens() {
</View> </View>
</BottomSheetScrollView> </BottomSheetScrollView>
</BottomSheetModal> </BottomSheetModal>
</KeyboardAvoidingView> </TouchableWithoutFeedback>
</KeyboardAwareScrollView>
); );
} }