-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
39 lines (35 loc) · 1.13 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
import { StyleSheet } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import AppNavigation from "./components/AppNavigation";
import { NavigationContainer } from "@react-navigation/native";
import { useState } from "react";
import OnboardingNavigation from "./components/OnboardingNavigation";
import { AuthProvider } from "./AuthContext";
export default function App() {
const [userAuthenticated, setUserAuthenticated] = useState(false);
// Function to update authentication state after successful login or signup
const updateAuthentication = (authenticated) => {
setUserAuthenticated(authenticated);
};
return (
<SafeAreaProvider>
<AuthProvider>
<NavigationContainer>
{!userAuthenticated ? (
<OnboardingNavigation updateAuthentication={updateAuthentication} />
) : (
<AppNavigation />
)}
</NavigationContainer>
</AuthProvider>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});