update
This commit is contained in:
@@ -7,6 +7,7 @@ import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { authApi } from 'api/auth';
|
||||
import { loginPayload } from 'api/auth/type';
|
||||
import { Branch, branchApi } from 'api/branch';
|
||||
import AppText from 'components/AppText';
|
||||
import formatPhone from 'helpers/formatPhone';
|
||||
import React, {
|
||||
useCallback,
|
||||
@@ -23,7 +24,6 @@ import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
ScrollView,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
@@ -156,10 +156,10 @@ const Login = () => {
|
||||
style={Loginstyle.background}
|
||||
resizeMode="contain"
|
||||
imageStyle={{
|
||||
opacity: 0.3,
|
||||
opacity: 0.1,
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
transform: [{ scale: 1.5 }],
|
||||
transform: [{ scale: 1 }],
|
||||
}}
|
||||
>
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
@@ -176,7 +176,9 @@ const Login = () => {
|
||||
<ScrollView style={{ flex: 1 }}>
|
||||
<View style={Loginstyle.scrollContainer}>
|
||||
<View style={Loginstyle.loginContainer}>
|
||||
<Text style={Loginstyle.title}>{t('Tizimga kirish')}</Text>
|
||||
<AppText style={Loginstyle.title}>
|
||||
{t('Tizimga kirish')}
|
||||
</AppText>
|
||||
<Controller
|
||||
control={control}
|
||||
name="phone"
|
||||
@@ -184,9 +186,9 @@ const Login = () => {
|
||||
const formatted = formatPhone(rawPhone);
|
||||
return (
|
||||
<View>
|
||||
<Text style={Loginstyle.label}>
|
||||
<AppText style={Loginstyle.label}>
|
||||
{t('Telefon raqami')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<TextInput
|
||||
keyboardType="numeric"
|
||||
placeholder="+998 90 123-45-67"
|
||||
@@ -197,18 +199,18 @@ const Login = () => {
|
||||
maxLength={19} // +998 90 123-45-67 bo'lishi uchun
|
||||
/>
|
||||
{errors.phone && (
|
||||
<Text style={Loginstyle.errorText}>
|
||||
<AppText style={Loginstyle.errorText}>
|
||||
{t(errors.phone.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<View>
|
||||
<Text style={Loginstyle.label}>
|
||||
<AppText style={Loginstyle.label}>
|
||||
{t('Passport seriya raqami')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<View style={{ flexDirection: 'row' }}>
|
||||
<Controller
|
||||
control={control}
|
||||
@@ -251,10 +253,10 @@ const Login = () => {
|
||||
/>
|
||||
</View>
|
||||
{(errors.passportSeriya || errors.passportNumber) && (
|
||||
<Text style={Loginstyle.errorText}>
|
||||
<AppText style={Loginstyle.errorText}>
|
||||
{t(errors.passportSeriya?.message || '') ||
|
||||
t(errors.passportNumber?.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@@ -263,7 +265,7 @@ const Login = () => {
|
||||
name="branchId"
|
||||
render={({ field: { value } }) => (
|
||||
<View style={{ position: 'relative' }}>
|
||||
<Text style={Loginstyle.label}>{t('Filial')}</Text>
|
||||
<AppText style={Loginstyle.label}>{t('Filial')}</AppText>
|
||||
<View style={Loginstyle.input}>
|
||||
<TouchableOpacity
|
||||
style={Loginstyle.selector}
|
||||
@@ -271,7 +273,7 @@ const Login = () => {
|
||||
setFilialDropdownVisible(prev => !prev)
|
||||
}
|
||||
>
|
||||
<Text
|
||||
<AppText
|
||||
style={
|
||||
value
|
||||
? { color: '#000' }
|
||||
@@ -280,7 +282,7 @@ const Login = () => {
|
||||
>
|
||||
{branchList?.find(e => e.id === value)?.name ||
|
||||
t('Filialni tanlang...')}
|
||||
</Text>
|
||||
</AppText>
|
||||
{filialDropdownVisible ? (
|
||||
<ArrowUp color={'#000'} />
|
||||
) : (
|
||||
@@ -301,21 +303,23 @@ const Login = () => {
|
||||
setFilialDropdownVisible(false);
|
||||
}}
|
||||
>
|
||||
<Text style={Loginstyle.dropdownItemText}>
|
||||
<AppText style={Loginstyle.dropdownItemText}>
|
||||
{item.name}
|
||||
</Text>
|
||||
</AppText>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{errors.branchId && (
|
||||
<Text style={Loginstyle.errorText}>
|
||||
<AppText style={Loginstyle.errorText}>
|
||||
{t(errors.branchId.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
{error && (
|
||||
<Text style={[Loginstyle.errorText]}>{t(error)}</Text>
|
||||
<AppText style={[Loginstyle.errorText]}>
|
||||
{t(error)}
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -328,9 +332,9 @@ const Login = () => {
|
||||
{isPending ? (
|
||||
<ActivityIndicator color="#fff" />
|
||||
) : (
|
||||
<Text style={Loginstyle.btnText}>
|
||||
<AppText style={Loginstyle.btnText}>
|
||||
{t('Tizimga kirish')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
<View
|
||||
@@ -340,14 +344,14 @@ const Login = () => {
|
||||
alignItems: 'center',
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 14, fontWeight: '500' }}>
|
||||
<AppText style={{ fontSize: 14, fontWeight: '500' }}>
|
||||
{t('ID va kabinet yo’qmi?')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<TouchableOpacity
|
||||
style={Loginstyle.dropdownItem}
|
||||
onPress={() => navigation.navigate('Register')}
|
||||
>
|
||||
<Text
|
||||
<AppText
|
||||
style={{
|
||||
color: '#28A7E8',
|
||||
fontSize: 14,
|
||||
@@ -355,7 +359,7 @@ const Login = () => {
|
||||
}}
|
||||
>
|
||||
{t('Ro’yxatdan o’tish')}
|
||||
</Text>
|
||||
</AppText>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user