139 lines
3.4 KiB
TypeScript
139 lines
3.4 KiB
TypeScript
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
||
import React from 'react';
|
||
import {
|
||
Image,
|
||
ScrollView,
|
||
StyleSheet,
|
||
Text,
|
||
TouchableOpacity,
|
||
useWindowDimensions,
|
||
View,
|
||
} from 'react-native';
|
||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||
import RU from 'screens/../../assets/bootsplash/RU.png';
|
||
import UZ from 'screens/../../assets/bootsplash/UZ.png';
|
||
import Logo from 'screens/../../assets/bootsplash/logo_512.png';
|
||
import { RootStackParamList } from 'types/types';
|
||
|
||
type NavigationProp = NativeStackNavigationProp<RootStackParamList>;
|
||
const SelectLangPage = ({
|
||
onSelectLang,
|
||
}: {
|
||
onSelectLang: (lang: 'uz' | 'ru') => void;
|
||
}) => {
|
||
const { width } = useWindowDimensions();
|
||
const isSmallScreen = width < 380;
|
||
|
||
return (
|
||
<SafeAreaView style={{ flex: 1 }}>
|
||
<View style={styles.container}>
|
||
<ScrollView
|
||
style={{ flex: 1 }}
|
||
contentContainerStyle={styles.scrollContent}
|
||
showsVerticalScrollIndicator={false}
|
||
>
|
||
<View style={[styles.innerContainer, { maxWidth: 500 }]}>
|
||
<View style={styles.logoWrapper}>
|
||
<Image
|
||
source={Logo}
|
||
style={[
|
||
styles.logoImage,
|
||
{
|
||
width: 180,
|
||
height: 180,
|
||
},
|
||
]}
|
||
/>
|
||
<Text style={[styles.logoText, { fontSize: 24 }]}>CPOST</Text>
|
||
</View>
|
||
|
||
<Text style={[styles.title, { fontSize: 24 }]}>
|
||
Tilni tanlang{' '}
|
||
<Text style={[styles.title, { fontSize: 18 }]}>
|
||
(Выберите язык)
|
||
</Text>
|
||
</Text>
|
||
|
||
<View style={styles.btnContainer}>
|
||
<TouchableOpacity
|
||
onPress={() => onSelectLang('uz')}
|
||
style={styles.button}
|
||
>
|
||
<Image source={UZ} style={styles.flag} />
|
||
<Text style={styles.btnText}>O'zbek tili</Text>
|
||
</TouchableOpacity>
|
||
|
||
<TouchableOpacity
|
||
onPress={() => onSelectLang('ru')}
|
||
style={styles.button}
|
||
>
|
||
<Image source={RU} style={styles.flag} />
|
||
<Text style={styles.btnText}>Русский язык</Text>
|
||
</TouchableOpacity>
|
||
</View>
|
||
</View>
|
||
</ScrollView>
|
||
</View>
|
||
</SafeAreaView>
|
||
);
|
||
};
|
||
|
||
export default SelectLangPage;
|
||
|
||
const styles = StyleSheet.create({
|
||
container: {
|
||
flex: 1,
|
||
paddingHorizontal: 20,
|
||
margin: 5,
|
||
borderRadius: 12,
|
||
},
|
||
scrollContent: {
|
||
flex: 1,
|
||
justifyContent: 'center',
|
||
alignItems: 'center',
|
||
},
|
||
innerContainer: {
|
||
width: '100%',
|
||
paddingHorizontal: 10,
|
||
},
|
||
logoWrapper: {
|
||
alignItems: 'center',
|
||
marginBottom: 20,
|
||
},
|
||
logoImage: {
|
||
resizeMode: 'stretch',
|
||
},
|
||
logoText: {
|
||
fontWeight: '500',
|
||
marginTop: 4,
|
||
color: '#28A7E8',
|
||
},
|
||
title: {
|
||
fontWeight: '500',
|
||
textAlign: 'center',
|
||
color: '#28A7E8',
|
||
marginBottom: 20,
|
||
},
|
||
button: {
|
||
backgroundColor: '#28A7E8',
|
||
height: 56,
|
||
borderRadius: 6,
|
||
flexDirection: 'row',
|
||
alignItems: 'center',
|
||
gap: 10,
|
||
paddingHorizontal: 16,
|
||
},
|
||
btnText: {
|
||
color: '#fff',
|
||
fontSize: 18,
|
||
},
|
||
btnContainer: {
|
||
gap: 16,
|
||
},
|
||
flag: {
|
||
width: 30,
|
||
height: 30,
|
||
resizeMode: 'cover',
|
||
},
|
||
});
|