-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.jsx
More file actions
47 lines (41 loc) · 1.27 KB
/
App.jsx
File metadata and controls
47 lines (41 loc) · 1.27 KB
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
39
40
41
42
43
44
45
46
47
import { useState, useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import { ActivityIndicator } from "react-native";
import Toast from "react-native-toast-message";
import { init, resetStorage } from "./helpers/storage/storageCore";
import NavigationWrapper from "./components/Navigation/NavigationWrapper";
import "./components/globals.css";
export default function App() {
const [dbInitialized, setDbInitialized] = useState(false);
useEffect(() => {
async function initializeDatabase() {
try {
/*
The method resetStorage() is primarily used for development and testing.
It is not recommended to use this method in production as it will delete all data.
Instead, use the init() method for production or for testing data persistence between sessions.
*/
await init();
setDbInitialized(true);
} catch (err) {
console.error(
"An error occurred while trying to initialize the database: ",
err
);
}
}
if (!dbInitialized) {
initializeDatabase();
}
}, []);
if (!dbInitialized) {
return <ActivityIndicator />;
}
return (
<>
<StatusBar style="dark" />
<NavigationWrapper />
<Toast />
</>
);
}