This commit is contained in:
azizziy
2025-08-28 10:05:01 +05:00
parent c1cefc0133
commit 03c8ba8540
5 changed files with 55 additions and 67 deletions

2
.env
View File

@@ -1 +1 @@
API_URL=http://141.105.64.233:7723/api/v1
API_URL=https://api.cpcargo.uz/api/v1

View File

@@ -1,4 +1,4 @@
export const BASE_URL = 'http://141.105.64.233:7723/api/v1';
export const BASE_URL = 'https://api.cpcargo.uz/api/v1';
export const REGISTER = '/mobile/auth/register';
export const LOGIN = '/mobile/auth/login';

View File

@@ -3,7 +3,7 @@ import axios, { AxiosError } from 'axios';
import { navigate } from 'components/NavigationRef';
const axiosInstance = axios.create({
baseURL: 'http://141.105.64.233:7723/api/v1',
baseURL: 'https://api.cpcargo.uz/api/v1',
timeout: 10000,
headers: {
'Content-Type': 'application/json',

View File

@@ -94,13 +94,13 @@ const styles = StyleSheet.create({
wrapper: {
bottom: 0,
width: '100%',
height: 60,
height: 70,
},
container: {
height: '100%',
backgroundColor: '#fff',
borderTopLeftRadius: 30,
borderTopRightRadius: 30,
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
flexDirection: 'row',
shadowColor: '#000',
shadowOpacity: 0.1,

View File

@@ -1,12 +1,6 @@
import { Dispatch, SetStateAction, useCallback, useMemo } from 'react';
import { Dispatch, SetStateAction, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import {
FlatList,
Image,
Text,
TouchableOpacity,
useWindowDimensions,
} from 'react-native';
import { Image, Text, TouchableOpacity, View } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import AviaLogo from 'screens/../../assets/bootsplash/Avia.png';
import AutoLogo from 'screens/../../assets/bootsplash/auto.png';
@@ -19,8 +13,6 @@ interface Props {
const Tabs = ({ activeTab, setActiveTab }: Props) => {
const { t } = useTranslation();
const { width: screenWidth } = useWindowDimensions();
const cardWidth = screenWidth * 0.95;
const styles = useMemo(() => HomeStyle(), []);
const gradientStyle = useMemo(
@@ -29,9 +21,7 @@ const Tabs = ({ activeTab, setActiveTab }: Props) => {
borderRadius: 8,
flexDirection: 'row' as const,
alignItems: 'center' as const,
paddingHorizontal: 12,
height: 80,
gap: 8,
}),
[],
);
@@ -53,57 +43,55 @@ const Tabs = ({ activeTab, setActiveTab }: Props) => {
[t],
);
const renderItem = useCallback(
({ item }: { item: (typeof tabsData)[number] }) => {
const isActive = activeTab === item.type;
const gradientColors = isActive
? ['#28A7E8', '#28A7E8']
: ['#28a8e82d', '#28A7E8'];
return (
<TouchableOpacity
onPress={() => setActiveTab(item.type)}
style={{ flex: 1 }}
>
<LinearGradient
colors={gradientColors}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 0 }}
style={gradientStyle}
>
<Image source={item.logo} style={styles.tabsLogo} />
<Text
style={[styles.tabsText, { color: isActive ? '#fff' : '#000' }]}
>
{item.label}
</Text>
</LinearGradient>
</TouchableOpacity>
);
},
[activeTab, styles, gradientStyle, setActiveTab],
);
return (
<FlatList
data={tabsData}
numColumns={2}
keyExtractor={(_, idx) => idx.toString()}
renderItem={renderItem}
showsHorizontalScrollIndicator={false}
scrollEnabled={false}
columnWrapperStyle={{
gap: 8,
}}
contentContainerStyle={{
paddingHorizontal: (screenWidth - cardWidth) / 2,
}}
getItemLayout={(_, index) => ({
length: cardWidth,
offset: cardWidth * index,
index,
<View style={{ flexDirection: 'row', paddingHorizontal: 10, gap: 12 }}>
{tabsData.map(item => {
const isActive = activeTab === item.type;
const gradientColors = isActive
? ['#28A7E8', '#28A7E8']
: ['#28a8e82d', '#28A7E8'];
return (
<TouchableOpacity
onPress={() => setActiveTab(item.type)}
style={{ flex: 1 }}
>
<LinearGradient
colors={gradientColors}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 0 }}
style={gradientStyle}
>
<Image source={item.logo} style={styles.tabsLogo} />
<Text
style={[styles.tabsText, { color: isActive ? '#fff' : '#000' }]}
>
{item.label}
</Text>
</LinearGradient>
</TouchableOpacity>
);
})}
/>
</View>
// <FlatList
// data={tabsData}
// numColumns={2}
// keyExtractor={(_, idx) => idx.toString()}
// renderItem={renderItem}
// showsHorizontalScrollIndicator={false}
// scrollEnabled={false}
// columnWrapperStyle={{
// gap: 8,
// }}
// contentContainerStyle={{
// paddingHorizontal: (screenWidth - cardWidth) / 2,
// }}
// getItemLayout={(_, index) => ({
// length: cardWidth,
// offset: cardWidth * index,
// index,
// })}
// />
);
};