-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
38 lines (34 loc) · 1.02 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { useState, useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import Navigation from "./app/navigations/Navigation";
import { RootSiblingParent } from "react-native-root-siblings";
import * as SplashScreen from "expo-splash-screen";
import { database } from "./app/utils/database";
export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
useEffect(() => {
async function prepare() {
try {
// Mantengo el Splashscreen visible hasta que se haya inicializado la base de datos
await SplashScreen.preventAutoHideAsync();
await database.setupDatabaseAsync();
} catch (e) {
console.warn(e);
} finally {
setAppIsReady(true);
await SplashScreen.hideAsync();
}
}
prepare();
}, []);
if (!appIsReady) {
return null;
} else {
return (
<RootSiblingParent>
<StatusBar style="auto" backgroundColor="#13b5f1" />
<Navigation />
</RootSiblingParent>
);
}
}