-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
53 lines (42 loc) · 1.41 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { NavigationContainer } from "@react-navigation/native";
import React, { useState, useEffect } from 'react';
import { NativeBaseProvider } from 'native-base';
import Toast from 'react-native-toast-message';
import AsyncStorage from "@react-native-async-storage/async-storage";
// Screens
import Main from "./Navigators/Main";
import WelcomeNavigator from "./Navigators/WelcomeNavigator";
const ToastProvider = () => {
useEffect(() => {
// Set up any necessary configurations for the Toast component
}, []);
return <Toast />;
};
export default function App() {
const [isAuthenticated, setIsAuthenticated] = useState(false);
useEffect(() => {
const checkRememberSignIn = async () => {
try {
const rememberSignInValue = await AsyncStorage.getItem("rememberSignIn");
console.log(rememberSignInValue);
if (rememberSignInValue === "true") {
//setIsAuthenticated(true);
}
} catch (error) {
console.log("Error retrieving rememberSignIn value:", error);
}
};
//setIsAuthenticated(true);
//checkRememberSignIn();
//storeRememberSignIn(false);
console.log("App.js isAuthenticated: "+isAuthenticated);
}, []);
return (
<NativeBaseProvider>
<NavigationContainer>
{isAuthenticated ? <Main/> : <WelcomeNavigator/>}
<ToastProvider />
</NavigationContainer>
</NativeBaseProvider>
);
}