33 lines
732 B
TypeScript
33 lines
732 B
TypeScript
import { AuthProvider } from "@/contexts/AuthContext";
|
|
import { initDB } from "@/services/db";
|
|
import { Stack } from "expo-router";
|
|
import React, { useEffect } from "react";
|
|
import { Alert } from "react-native";
|
|
|
|
function RootLayoutNav() {
|
|
useEffect(() => {
|
|
initDB().catch((error) => {
|
|
console.error("Database initialization failed:", error);
|
|
Alert.alert(
|
|
"Erro",
|
|
"Falha ao inicializar o banco de dados. Alguns recursos podem não funcionar corretamente.",
|
|
);
|
|
});
|
|
}, []);
|
|
|
|
return (
|
|
<Stack
|
|
screenOptions={{
|
|
headerShown: false,
|
|
}}
|
|
/>
|
|
);
|
|
}
|
|
|
|
export default function Layout() {
|
|
return (
|
|
<AuthProvider>
|
|
<RootLayoutNav />
|
|
</AuthProvider>
|
|
);
|
|
}
|