Skip to content

Commit 5c56838

Browse files
authored
Merge pull request #18 from Team-DailySnap/feat/navigation-bar
Feat/navigation bar
2 parents 7f8eaea + a30ae61 commit 5c56838

18 files changed

Lines changed: 725 additions & 101 deletions

app/(tabs)/_layout.tsx

Lines changed: 50 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,55 @@
1+
import { Icon } from "@/shared/ui/icon";
2+
import { DefaultNavigationOptions } from "@/shared/ui/navigation";
13
import { Tabs } from "expo-router";
4+
import { useMemo } from "react";
5+
import { SafeAreaView } from "react-native-safe-area-context";
26

3-
export default function TabsLayout() {
4-
return (
5-
<Tabs
6-
screenOptions={{
7-
headerShown: false,
8-
}}
9-
>
10-
<Tabs.Screen
11-
name="home"
12-
options={{
13-
title: "홈",
14-
}}
15-
/>
16-
17-
<Tabs.Screen
18-
name="archive"
19-
options={{
20-
title: "아카이브",
21-
}}
22-
/>
23-
24-
<Tabs.Screen
25-
name="upload"
26-
options={{
27-
title: "업로드",
28-
}}
29-
/>
7+
export default function TabLayout() {
8+
const screenOptions = useMemo(() => {
9+
return {
10+
...DefaultNavigationOptions,
11+
};
12+
}, []);
3013

31-
<Tabs.Screen
32-
name="awards"
33-
options={{
34-
title: "우수작",
35-
}}
36-
/>
37-
38-
<Tabs.Screen
39-
name="profile"
40-
options={{
41-
title: "마이",
42-
}}
43-
/>
44-
</Tabs>
14+
return (
15+
<SafeAreaView edges={["top"]} style={{ flex: 1 }}>
16+
<Tabs screenOptions={screenOptions}>
17+
<Tabs.Screen
18+
name="home"
19+
options={{
20+
title: "홈",
21+
tabBarIcon: ({ focused }) => <Icon name={focused ? "home_active" : "home"} />,
22+
}}
23+
/>
24+
<Tabs.Screen
25+
name="archive"
26+
options={{
27+
title: "아카이빙",
28+
tabBarIcon: ({ focused }) => <Icon name={focused ? "archiving_active" : "archiving"} />,
29+
}}
30+
/>
31+
<Tabs.Screen
32+
name="upload"
33+
options={{
34+
title: "업로드",
35+
tabBarIcon: ({ focused }) => <Icon name={focused ? "uploading_active" : "uploading"} />,
36+
}}
37+
/>
38+
<Tabs.Screen
39+
name="awards"
40+
options={{
41+
title: "우수작",
42+
tabBarIcon: ({ focused }) => <Icon name={focused ? "ranking_active" : "ranking"} />,
43+
}}
44+
/>
45+
<Tabs.Screen
46+
name="profile"
47+
options={{
48+
title: "마이",
49+
tabBarIcon: ({ focused }) => <Icon name={focused ? "my_active" : "my"} />,
50+
}}
51+
/>
52+
</Tabs>
53+
</SafeAreaView>
4554
);
4655
}

app/index.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@ import { View, ActivityIndicator } from "react-native";
66

77
export default function App() {
88
const router = useRouter();
9-
const { userInfo } = useAuth();
9+
// const { userInfo } = useAuth();
1010

1111
useEffect(() => {
1212
const timer = setTimeout(() => {
13-
if (userInfo) {
14-
// 로그인된 사용자면, 홈 네비게이션으로 이동
15-
router.replace("/(tabs)/home");
16-
} else {
17-
// 로그인되지 않았으면 로그인 페이지로 이동
18-
router.replace("/login");
19-
}
13+
router.replace("/(tabs)/home");
14+
// if (userInfo) {
15+
// // 로그인된 사용자면, 홈 네비게이션으로 이동
16+
// router.replace("/(tabs)/home");
17+
// } else {
18+
// // 로그인되지 않았으면 로그인 페이지로 이동
19+
// router.replace("/login");
20+
// }
2021
}, 100);
2122

2223
return () => clearTimeout(timer);
23-
}, [userInfo, router]);
24+
}, [router]);
2425

2526
// 로딩 화면 표시. TODO: 추후에 디자인 된 로딩스피너로 수정
2627
return (
27-
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
28+
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
2829
<ActivityIndicator size="large" color="#195B35" />
2930
</View>
3031
);

metro.config.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
const { getDefaultConfig } = require("expo/metro-config");
22

3-
/** @type {import('expo/metro-config').MetroConfig} */
4-
const config = getDefaultConfig(__dirname);
5-
config.resolver.sourceExts.push("css");
6-
config.resolver.assetExts.push("png", "jpg", "jpeg", "gif", "svg");
3+
module.exports = (() => {
4+
const config = getDefaultConfig(__dirname);
75

8-
module.exports = config;
6+
const { transformer, resolver } = config;
7+
8+
config.transformer = {
9+
...transformer,
10+
babelTransformerPath: require.resolve("react-native-svg-transformer/expo"),
11+
};
12+
config.resolver = {
13+
...resolver,
14+
assetExts: resolver.assetExts.filter(ext => ext !== "svg"),
15+
sourceExts: [...resolver.sourceExts, "svg"],
16+
};
17+
18+
return config;
19+
})();

0 commit comments

Comments
 (0)