update
This commit is contained in:
@@ -13,6 +13,7 @@ import { useMutation, useQuery } from '@tanstack/react-query';
|
||||
import { authApi } from 'api/auth';
|
||||
import { registerPayload } from 'api/auth/type';
|
||||
import { Branch, branchApi } from 'api/branch';
|
||||
import AppText from 'components/AppText';
|
||||
import formatPhone from 'helpers/formatPhone';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
@@ -24,7 +25,6 @@ import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
ScrollView,
|
||||
Text,
|
||||
TextInput,
|
||||
TouchableOpacity,
|
||||
View,
|
||||
@@ -194,10 +194,10 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
style={RegisterStyle.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 }}>
|
||||
@@ -217,16 +217,16 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
>
|
||||
<View style={RegisterStyle.scrollContainer}>
|
||||
<View style={RegisterStyle.loginContainer}>
|
||||
<Text style={RegisterStyle.title}>
|
||||
<AppText style={RegisterStyle.title}>
|
||||
{t("Ro'yxatdan o'tish")}
|
||||
</Text>
|
||||
</AppText>
|
||||
|
||||
<Controller
|
||||
control={control}
|
||||
name="firstName"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<View>
|
||||
<Text style={RegisterStyle.label}>{t('Ism')}</Text>
|
||||
<AppText style={RegisterStyle.label}>{t('Ism')} </AppText>
|
||||
<TextInput
|
||||
style={RegisterStyle.input}
|
||||
placeholder={t('Ismingiz')}
|
||||
@@ -235,9 +235,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
placeholderTextColor={'#D8DADC'}
|
||||
/>
|
||||
{errors.firstName && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.firstName.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -247,7 +247,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
name="lastName"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<View>
|
||||
<Text style={RegisterStyle.label}>{t('Familiya')}</Text>
|
||||
<AppText style={RegisterStyle.label}>
|
||||
{t('Familiya')}{' '}
|
||||
</AppText>
|
||||
<TextInput
|
||||
style={RegisterStyle.input}
|
||||
placeholder={t('Familiyangiz')}
|
||||
@@ -256,9 +258,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
value={value}
|
||||
/>
|
||||
{errors.lastName && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.lastName.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -270,9 +272,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
const formatted = formatPhone(rawPhone);
|
||||
return (
|
||||
<View>
|
||||
<Text style={RegisterStyle.label}>
|
||||
<AppText style={RegisterStyle.label}>
|
||||
{t('Telefon raqami')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<TextInput
|
||||
keyboardType="numeric"
|
||||
placeholder="+998 __ ___-__-__"
|
||||
@@ -290,9 +292,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
maxLength={17}
|
||||
/>
|
||||
{errors.phoneNumber && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.phoneNumber.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
@@ -303,7 +305,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
name="branchId"
|
||||
render={({ field: { value } }) => (
|
||||
<View style={{ position: 'relative' }}>
|
||||
<Text style={RegisterStyle.label}>{t('Filial')}</Text>
|
||||
<AppText style={RegisterStyle.label}>
|
||||
{t('Filial')}{' '}
|
||||
</AppText>
|
||||
<View style={RegisterStyle.input}>
|
||||
<TouchableOpacity
|
||||
style={RegisterStyle.selector}
|
||||
@@ -311,7 +315,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
setFilialDropdownVisible(prev => !prev)
|
||||
}
|
||||
>
|
||||
<Text
|
||||
<AppText
|
||||
style={
|
||||
value
|
||||
? { color: '#000' }
|
||||
@@ -320,7 +324,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
>
|
||||
{branchList?.find(e => e.id === value)?.name ||
|
||||
t('Filialni tanlang...')}
|
||||
</Text>
|
||||
</AppText>
|
||||
{filialDropdownVisible ? (
|
||||
<ArrowUp color={'#000'} />
|
||||
) : (
|
||||
@@ -343,18 +347,20 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
setFilialDropdownVisible(false);
|
||||
}}
|
||||
>
|
||||
<Text style={RegisterStyle.dropdownItemText}>
|
||||
<AppText
|
||||
style={RegisterStyle.dropdownItemText}
|
||||
>
|
||||
{item.name}
|
||||
</Text>
|
||||
</AppText>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{errors.branchId && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.branchId.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -364,9 +370,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
name="address"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<View>
|
||||
<Text style={RegisterStyle.label}>
|
||||
<AppText style={RegisterStyle.label}>
|
||||
{t('Manzilingizni kiriting')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<TextInput
|
||||
style={RegisterStyle.input}
|
||||
placeholder={t(
|
||||
@@ -377,9 +383,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
value={value}
|
||||
/>
|
||||
{errors.lastName && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.lastName.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -389,9 +395,9 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
name="recommend"
|
||||
render={({ field: { value } }) => (
|
||||
<View style={{ position: 'relative' }}>
|
||||
<Text style={RegisterStyle.label}>
|
||||
<AppText style={RegisterStyle.label}>
|
||||
{t('Bizni qaerdan topdingiz?')}
|
||||
</Text>
|
||||
</AppText>
|
||||
<View style={RegisterStyle.input}>
|
||||
<TouchableOpacity
|
||||
style={RegisterStyle.selector}
|
||||
@@ -399,7 +405,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
setRecommendedDropdownVisible(prev => !prev)
|
||||
}
|
||||
>
|
||||
<Text
|
||||
<AppText
|
||||
style={
|
||||
value
|
||||
? { color: '#000' }
|
||||
@@ -410,7 +416,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
recommended.find(e => e.value === value)?.label ||
|
||||
'Bizni kim tavsiya qildi...',
|
||||
)}
|
||||
</Text>
|
||||
</AppText>
|
||||
{recommendedDropdownVisible ? (
|
||||
<ArrowUp color={'#000'} />
|
||||
) : (
|
||||
@@ -432,23 +438,23 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
setRecommendedDropdownVisible(false);
|
||||
}}
|
||||
>
|
||||
<Text style={RegisterStyle.dropdownItemText}>
|
||||
<AppText style={RegisterStyle.dropdownItemText}>
|
||||
{t(item.label)}
|
||||
</Text>
|
||||
</AppText>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{errors.recommend && (
|
||||
<Text style={RegisterStyle.errorText}>
|
||||
<AppText style={RegisterStyle.errorText}>
|
||||
{t(errors.recommend.message || '')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
{error && (
|
||||
<Text style={[RegisterStyle.errorText]}>
|
||||
<AppText style={[RegisterStyle.errorText]}>
|
||||
{t(error)}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
@@ -491,10 +497,10 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
)}
|
||||
</Animated.View>
|
||||
<View style={RegisterStyle.termsTextContainer}>
|
||||
<Text style={RegisterStyle.termsText}>
|
||||
<Text>{t('Foydalanish shartlari')}</Text>
|
||||
<Text> {t('bilan tanishib chiqdim!')}</Text>
|
||||
</Text>
|
||||
<AppText style={RegisterStyle.termsText}>
|
||||
<AppText>{t('Foydalanish shartlari')} </AppText>
|
||||
<AppText> {t('bilan tanishib chiqdim!')} </AppText>
|
||||
</AppText>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
@@ -511,7 +517,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
{isPending ? (
|
||||
<ActivityIndicator color="#fff" />
|
||||
) : (
|
||||
<Text
|
||||
<AppText
|
||||
style={[
|
||||
RegisterStyle.btnText,
|
||||
(!termsAccepted || isPending) &&
|
||||
@@ -519,7 +525,7 @@ const FirstStep = ({ onNext }: { onNext: () => void }) => {
|
||||
]}
|
||||
>
|
||||
{t('Davom etish')}
|
||||
</Text>
|
||||
</AppText>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user