-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppInner.tsx
268 lines (258 loc) · 8.88 KB
/
AppInner.tsx
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import Discover from './src/pages/Discover';
import Matches from './src/pages/Matches';
import Messages from './src/pages/Messages';
import Account from './src/pages/Account';
import Main from './src/pages/Main';
import SignIn from './src/pages/SignIn/SignIn';
import SignUp from './src/pages/SignUp/SignUp';
import EmailSignUp from './src/pages/SignUp/EmailSignUp';
import PhoneSignUp from './src/pages/SignUp/PhoneSignUp';
import PhoneSignUpVerification from './src/pages/SignUp/PhoneSignUpVerification';
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import SearchId from './src/pages/SignIn/SearchId';
import SearchPassword from './src/pages/SignIn/SearchPassword';
import KakaoSignIn from './src/pages/SignIn/KakaoSignIn';
import GoogleSignIn from './src/pages/SignIn/GoogleSignIn';
import AppleSignIn from './src/pages/SignIn/AppleSignIn';
import NaverSignIn from './src/pages/SignIn/NaverSignIn';
import KakaoSignUp from './src/pages/SignUp/KakaoSignUp';
import GoogleSignUp from './src/pages/SignUp/GoogleSignUp';
import AppleSignUp from './src/pages/SignUp/AppleSignUp';
import NaverSignUp from './src/pages/SignUp/NaverSignUp';
import UserProfile from './src/pages/UserProfile';
import DogProfile from './src/pages/DogProfile';
import {useSelector} from 'react-redux';
import {RootState} from './src/store/reducer';
import {Pressable, Text} from 'react-native';
import {useEffect} from 'react';
import userSlice from './src/slices/user';
import {useAppDispatch} from './src/store';
export type RootStackParamList = {
SignIn: undefined; // 로그인 화면.
SignUp: undefined; // 회원가입 화면.
Main: undefined; // 비로그인시 메인화면
// 로그인 관련
KakaoSignIn: undefined;
GoogleSignIn: undefined;
AppleSignIn: undefined;
NaverSignIn: undefined;
// 계정찾기 관련
SearchId: undefined;
SearchPassword: undefined;
// 회원가입 관련
EmailSignUp: undefined;
PhoneSignUp: undefined;
PhoneSignUpVerification: undefined;
KakaoSignUp: undefined;
GoogleSignUp: undefined;
AppleSignUp: undefined;
NaverSignUp: undefined;
};
export type LoggedInParamList = {
UserProfile: undefined;
DogProfile: undefined;
Discover: undefined;
};
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator<RootStackParamList>();
const SettingStack = createNativeStackNavigator<RootStackParamList>();
const testData = {
name: '강현지',
email: '[email protected]',
phoneNumber: '12312341234',
};
function AppInner() {
const dispatch = useAppDispatch();
const isLoggedIn = useSelector((state: RootState) => !!state.user.email);
// const isLoggedIn = false;
const isProfileSettingComplete = false;
return (
<NavigationContainer>
{isLoggedIn ? (
// 로그인 되었을 때 볼 수 있는 화면
isProfileSettingComplete ? (
// 로그인 되었고, 프로필 설정이 완료되었을 때 볼 수 있는 화면
<Tab.Navigator>
<Tab.Screen
name="Discover"
component={Discover}
options={{
title: 'Discover',
tabBarIcon: ({color}) => (
<MaterialCommunityIcons
name="cards"
size={20}
style={{color}}
/>
),
tabBarActiveTintColor: '#E94057',
}}
/>
<Tab.Screen
name="Matches"
component={Matches}
options={{
title: 'Matches',
tabBarIcon: ({color}) => (
<MaterialCommunityIcons
name="cards-heart"
size={20}
style={{color}}
/>
),
tabBarActiveTintColor: '#E94057',
tabBarBadge: '',
tabBarBadgeStyle: {
maxWidth: 5,
maxHeight: 10,
top: 7,
borderColor: 'white',
borderWidth: 1,
},
}}
/>
<Tab.Screen
name="Messages"
component={Messages}
options={{
title: 'Messages',
unmountOnBlur: true,
tabBarIcon: ({color}) => (
<MaterialCommunityIcons
name="chat-processing"
size={22}
style={{color}}
/>
),
tabBarActiveTintColor: '#E94057',
}}
/>
<Tab.Screen
name="Account"
component={Account}
options={{
title: 'Account',
unmountOnBlur: true,
tabBarIcon: ({color}) => (
<FontAwesome5 name="user-alt" size={17} style={{color}} />
),
tabBarActiveTintColor: '#E94057',
}}
/>
</Tab.Navigator>
) : (
// 로그인 되었고, 프로필 설정이 완료되지 않았을 때 볼 수 있는 화면
<SettingStack.Navigator>
<SettingStack.Screen
name="UserProfile"
component={UserProfile}
options={{title: 'UserProfile', headerShown: false}}
/>
<SettingStack.Screen
name="DogProfile"
component={DogProfile}
options={{title: 'UserProfile', headerShown: false}}
/>
</SettingStack.Navigator>
)
) : (
// 로그인되지 않았을 때 볼 수 있는 화면
<Stack.Navigator>
<Stack.Screen
name="Main"
component={Main}
options={{title: 'Main', headerShown: false}}
/>
<Stack.Screen
name="SignIn"
component={SignIn}
options={{title: '로그인', headerShown: false}}
/>
<Stack.Screen
name="SignUp"
component={SignUp}
options={{title: '회원가입', headerShown: false}}
/>
<Stack.Screen
name="EmailSignUp"
component={EmailSignUp}
options={{title: '이메일회원가입', headerShown: false}}
/>
<Stack.Screen
name="PhoneSignUp"
component={PhoneSignUp}
options={{
title: '휴대폰회원가입',
headerShown: false,
headerBackVisible: true,
}}
/>
<Stack.Screen
name="PhoneSignUpVerification"
component={PhoneSignUpVerification}
options={{
title: '휴대폰검증',
headerShown: false,
headerBackVisible: true,
}}
/>
<Stack.Screen
name="SearchId"
component={SearchId}
options={{title: '아이디찾기', headerShown: false}}
/>
<Stack.Screen
name="SearchPassword"
component={SearchPassword}
options={{title: '비밀번호찾기', headerShown: false}}
/>
<Stack.Screen
name="KakaoSignIn"
component={KakaoSignIn}
options={{title: '카카오로그인', headerShown: false}}
/>
<Stack.Screen
name="GoogleSignIn"
component={GoogleSignIn}
options={{title: '구글로그인', headerShown: false}}
/>
<Stack.Screen
name="AppleSignIn"
component={AppleSignIn}
options={{title: '애플로그인', headerShown: false}}
/>
<Stack.Screen
name="NaverSignIn"
component={NaverSignIn}
options={{title: '네이버로그인', headerShown: false}}
/>
<Stack.Screen
name="KakaoSignUp"
component={KakaoSignUp}
options={{title: '카카오회원가입', headerShown: false}}
/>
<Stack.Screen
name="GoogleSignUp"
component={GoogleSignUp}
options={{title: '구글회원가입', headerShown: false}}
/>
<Stack.Screen
name="AppleSignUp"
component={AppleSignUp}
options={{title: '애플회원가입', headerShown: false}}
/>
<Stack.Screen
name="NaverSignUp"
component={NaverSignUp}
options={{title: '네이버회원가입', headerShown: false}}
/>
</Stack.Navigator>
)}
</NavigationContainer>
);
}
export default AppInner;