-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.jsx
46 lines (39 loc) · 1.47 KB
/
App.jsx
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
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { NavigationContainer } from "@react-navigation/native";
import { openDatabase } from "./src/functions/functions";
import { AppProvider } from "./src/Contexts/Contexts";
import { useEffect, useState } from "react";
import SplashScreen from "./src/components/SplashScreen";
import Details from "./src/screens/Details";
import History from "./src/screens/History";
import Home from "./src/screens/Home";
const Stack = createNativeStackNavigator();
const db = openDatabase();
export default function App() {
const [appReady, setAppReady] = useState(false);
useEffect(() => {
setTimeout(() => {
setAppReady(true);
}, 3000);
db.transaction((tx) => {
tx.executeSql(
"CREATE TABLE IF NOT EXISTS myData (id INTEGER PRIMARY KEY AUTOINCREMENT, date TEXT, qrData TEXT);"
);
});
}, []);
if (!appReady) return <SplashScreen />;
return (
<SafeAreaProvider style={{backgroundColor: ""}}>
<AppProvider>
<NavigationContainer>
<Stack.Navigator screenOptions={{ headerShown: false }}>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Details" component={Details} />
<Stack.Screen name="History" component={History} />
</Stack.Navigator>
</NavigationContainer>
</AppProvider>
</SafeAreaProvider>
);
}