-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppInner.tsx
More file actions
124 lines (114 loc) · 3.41 KB
/
AppInner.tsx
File metadata and controls
124 lines (114 loc) · 3.41 KB
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
import React from 'react';
import Icon from 'react-native-vector-icons/FontAwesome';
import Setting from './src/pages/ViewUserData/Setting';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import AlarmRingHandle from './src/pages/RingAlarms/AlarmRingHandle';
import AlarmList from '@/pages/EditAlarms/AlarmList';
import AlarmSettings from '@/pages/EditAlarms/AlarmSettings';
import PressStamps from '@/pages/Stamps/PressStamps';
import {Text} from 'react-native';
import {useAppDispatch} from '@/store';
import {useAxiosInterceptor} from '@/hooks/useAxiosInterceptor';
import {useAutoLogin} from '@/hooks/useAutoLogin';
import {useCheckNetwork} from '@/hooks/useCheckNetwork';
import AlarmLogPage from '@/pages/AlarmLogs/AlarmLogPage';
const Stack = createNativeStackNavigator();
const Tab = createBottomTabNavigator();
function AlarmTabs() {
const setColor = (focused: boolean) => {
return focused ? '#68A3B9' : '#D9E5E4';
};
const iconTextStyle = (focused: boolean) => {
return {color: setColor(focused), fontSize: 10, marginBottom: 5};
};
return (
<Tab.Navigator>
<Tab.Screen
name="알람"
component={AlarmList}
options={{
headerShown: false,
tabBarLabel: ({focused}) => (
<Text style={iconTextStyle(focused)}>알람</Text>
),
tabBarIcon: ({focused}) => {
return <Icon name="bell" size={20} color={setColor(focused)} />;
},
}}
/>
<Tab.Screen
name="응모"
component={PressStamps}
options={{
headerShown: false,
tabBarLabel: ({focused}) => (
<Text style={iconTextStyle(focused)}>응모</Text>
),
tabBarIcon: ({focused}) => (
<Icon name="gift" size={20} color={setColor(focused)} />
),
}}
/>
<Tab.Screen
name="기록"
component={AlarmLogPage}
options={{
headerShown: false,
tabBarIcon: ({focused}) => (
<Icon name="th-large" size={20} color={setColor(focused)} />
),
tabBarLabel: ({focused}) => (
<Text style={iconTextStyle(focused)}>기록</Text>
),
}}
/>
<Tab.Screen
name="설정"
component={Setting}
options={{
headerShown: false,
tabBarIcon: ({focused}) => (
<Icon name="gear" size={20} color={setColor(focused)} />
),
tabBarLabel: ({focused}) => (
<Text style={iconTextStyle(focused)}>설정</Text>
),
}}
/>
</Tab.Navigator>
);
}
function AlarmAppStacks() {
return (
<Stack.Navigator>
<Stack.Screen
name="Alarms"
component={AlarmTabs}
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="Edit"
component={AlarmSettings}
options={{title: '알람 시간 지정'}}
/>
<Stack.Screen
name="Ring"
component={AlarmRingHandle}
options={{
headerShown: false,
}}
/>
</Stack.Navigator>
);
}
function AppInner() {
const dispatch = useAppDispatch();
const connectionInfo = useCheckNetwork();
useAxiosInterceptor(dispatch);
useAutoLogin(dispatch, connectionInfo);
return <AlarmAppStacks />;
}
export default AppInner;