fitst commit

This commit is contained in:
Samandar Turgunboyev
2026-01-28 18:26:50 +05:00
parent 166a55b1e9
commit 124798419b
196 changed files with 26627 additions and 421 deletions

39
app/(auth)/index.tsx Normal file
View File

@@ -0,0 +1,39 @@
import { useAuth } from '@/components/AuthProvider';
import LoginScreen from '@/screens/auth/login/ui/LoginScreens';
import { router } from 'expo-router';
import { useEffect } from 'react';
import { ActivityIndicator, ScrollView, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function Index() {
const { isAuthenticated, isLoading } = useAuth();
// Loading spinner
if (isLoading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" color="#3b82f6" />
</View>
);
}
// Token bolsa dashboard-ga yonaltir
useEffect(() => {
if (isAuthenticated) {
router.replace('/(dashboard)');
}
}, [isAuthenticated]);
// Token yoq → login screen
if (!isAuthenticated) {
return (
<SafeAreaView style={{ flex: 1, backgroundColor: '#0f172a' }}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }}>
<LoginScreen />
</ScrollView>
</SafeAreaView>
);
}
return null;
}