Files
info-tager-mobile/app/(dashboard)/index.tsx
Samandar Turgunboyev 124798419b fitst commit
2026-01-28 18:26:50 +05:00

34 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// pages/home/index.tsx
import { useAuth } from '@/components/AuthProvider';
import { useTheme } from '@/components/ThemeContext';
import { FilterProvider } from '@/components/ui/FilterContext';
import { CustomHeader } from '@/components/ui/Header';
import HomeScreen from '@/screens/home/ui/HomeScreen';
import { router } from 'expo-router';
import { useEffect } from 'react';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function Index() {
const { isDark } = useTheme();
const { isAuthenticated, isLoading } = useAuth();
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.replace('/(auth)');
}
}, [isAuthenticated, isLoading]);
if (isLoading || !isAuthenticated) {
return null; // Loading vaqtida yoki auth yoq bolsa hech narsa kormasin
}
return (
<FilterProvider>
<SafeAreaView style={{ flex: 1, backgroundColor: isDark ? '#0f172a' : '#ffffff' }}>
<CustomHeader />
<HomeScreen />
</SafeAreaView>
</FilterProvider>
);
}