-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRouter.js
143 lines (140 loc) · 4.73 KB
/
Router.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import { StatusBar } from 'expo-status-bar';
import { Text, View, SafeAreaView, Button } from 'react-native';
import TabNavigation from './src/navigations/TabNavigation';
import styled from 'styled-components/native';
import { NavigationContainer } from '@react-navigation/native';
import { isLoginState } from './src/states';
import React from 'react';
import { RecoilRoot, useRecoilState } from 'recoil';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import { createStackNavigator } from '@react-navigation/stack';
import { LoginScreen, SignUpScreen, MainStack } from './src/screens';
import { HomeScreen } from './src/screens';
import SearchScreen from './src/screens/Main/SearchScreen';
import DetailScreen from './src/screens/Main/DetailScreen';
import { MyPageScreen } from './src/screens';
import { MyHeartScreen } from './src/screens';
import { MyStarScreen } from './src/screens';
import ChatHomeScreen from './src/screens/Chat/ChatHomeScreen';
import ChatRoomScreen from './src/screens/Chat/ChatRoomScreen';
import { SubscriptionScreen } from './src/screens';
import { MkSubRoomScreen } from './src/screens';
import * as Font from 'expo-font';
export default function Router() {
const Stack = createStackNavigator();
const [isLogin, setIsLogin] = useRecoilState(isLoginState);
return (
<SafeAreaProvider>
<Container>
<StatusBar style="auto" />
<NavigationContainer>
<Stack.Navigator>
{isLogin ? (
<>
<Stack.Screen
name="TabNavigation"
component={TabNavigation}
options={{
headerShown: false,
title: '',
}}
/>
<Stack.Screen
name="HomeScreen"
component={HomeScreen}
options={{ headerShown: false, title: '메인 화면' }}
/>
<Stack.Screen
name="SearchScreen"
component={SearchScreen}
options={{
title: '작품 검색',
}}
/>
<Stack.Screen
name="DetailScreen"
component={DetailScreen}
initialParams={{ workId: 1 }}
options={{
title: '작품 상세 보기',
}}
/>
<Stack.Screen
name="MyPageScreen"
component={MyPageScreen}
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="MyHeartScreen"
component={MyHeartScreen}
options={{
title: '내가 찜한 작품',
}}
/>
<Stack.Screen
name="MyStarScreen"
component={MyStarScreen}
options={{
title: '내가 평가한 작품',
}}
/>
<Stack.Screen
name="ChatHomeScreen"
component={ChatHomeScreen}
options={{
title: '채팅 홈',
}}
/>
<Stack.Screen
name="ChatRoomScreen"
component={ChatRoomScreen}
options={{
title: '채팅 방',
}}
/>
<Stack.Screen
name="SubScriptionScreen"
component={SubscriptionScreen}
options={{
title: '구독 홈',
}}
/>
<Stack.Screen
name="MkSubRoomScreen"
component={MkSubRoomScreen}
options={{
title: '구독방 만들기',
}}
/>
</>
) : (
<>
<Stack.Screen
name="LoginScreen"
component={LoginScreen}
options={{
headerShown: false, // 헤더 렌더링 ❌
title: '로그인',
}}
/>
<Stack.Screen
name="SignUpScreen"
component={SignUpScreen}
options={{
title: '회원가입',
}}
/>
</>
)}
</Stack.Navigator>
</NavigationContainer>
</Container>
</SafeAreaProvider>
);
}
const Container = styled.View`
flex: 1;
justify-content: flex-start;
`;