-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
44 lines (40 loc) · 1.26 KB
/
index.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
/**
* @format
*/
import "react-native-gesture-handler";
import React, { useState } from "react";
import { AppRegistry } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { AuthProvider } from "./src/contexts/AuthContext";
import TabNavigator from "./src/navigators/TabNavigator";
import AuthStack from "./src/navigators/AuthStack";
import { name as appName } from "./app.json";
const Stack = createStackNavigator();
function App() {
const [isLoggedIn, setLoggedIn] = useState(false); // 초기 조건 설정
return (
<AuthProvider>
<NavigationContainer>
<Stack.Navigator
initialRouteName={isLoggedIn ? "TabNavigator" : "AuthStack"}
>
{/* AuthStack */}
<Stack.Screen
name="AuthStack"
component={AuthStack}
options={{ headerShown: false }}
/>
{/* TabNavigator */}
<Stack.Screen
name="TabNavigator"
component={TabNavigator}
options={{ headerShown: false }}
/>
</Stack.Navigator>
</NavigationContainer>
</AuthProvider>
);
}
AppRegistry.registerComponent(appName, () => App);
export default App;