erp-core/mobile/app/_layout.tsx
rckrdmrd 0086695b4c
Some checks failed
ERP Core CI / Backend Lint (push) Has been cancelled
ERP Core CI / Backend Unit Tests (push) Has been cancelled
ERP Core CI / Backend Integration Tests (push) Has been cancelled
ERP Core CI / Frontend Lint (push) Has been cancelled
ERP Core CI / Frontend Unit Tests (push) Has been cancelled
ERP Core CI / Frontend E2E Tests (push) Has been cancelled
ERP Core CI / Database DDL Validation (push) Has been cancelled
ERP Core CI / Backend Build (push) Has been cancelled
ERP Core CI / Frontend Build (push) Has been cancelled
ERP Core CI / CI Success (push) Has been cancelled
Performance Tests / Lighthouse CI (push) Has been cancelled
Performance Tests / Bundle Size Analysis (push) Has been cancelled
Performance Tests / k6 Load Tests (push) Has been cancelled
Performance Tests / Performance Summary (push) Has been cancelled
[SIMCO-V38] feat: Actualizar a SIMCO v3.8.0 + cambios backend
- HERENCIA-SIMCO.md actualizado con directivas v3.7 y v3.8
- Actualizaciones en modulos CRM y OpenAPI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 08:53:05 -06:00

59 lines
1.4 KiB
TypeScript

/**
* Root Layout
*
* Main app layout with authentication flow control
*/
import { useEffect } from 'react';
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import * as SplashScreen from 'expo-splash-screen';
import { useAuthStore } from '@/stores';
// Keep splash screen visible while loading
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
const { isLoading, isAuthenticated, loadStoredAuth } = useAuthStore();
useEffect(() => {
// Load stored authentication on app start
loadStoredAuth();
}, []);
useEffect(() => {
// Hide splash screen when loading is complete
if (!isLoading) {
SplashScreen.hideAsync();
}
}, [isLoading]);
// Show nothing while loading (splash screen is visible)
if (isLoading) {
return null;
}
return (
<>
<StatusBar style="auto" />
<Stack screenOptions={{ headerShown: false }}>
{!isAuthenticated ? (
// Auth screens
<Stack.Screen name="(auth)" options={{ headerShown: false }} />
) : (
// Main app screens
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
)}
<Stack.Screen
name="modal"
options={{
presentation: 'modal',
headerShown: true,
headerTitle: '',
}}
/>
</Stack>
</>
);
}