App.js 2.35 KB
Newer Older
Choi Ga Young's avatar
Choi Ga Young committed
1
import React, { useState } from 'react';
Choi Ga Young's avatar
Choi Ga Young committed
2
3
4
import { StyleSheet, View, Text, TextInput, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
Choi Ga Young's avatar
Choi Ga Young committed
5
import { createStackNavigator } from '@react-navigation/stack';
Choi Ga Young's avatar
Choi Ga Young committed
6
7
import Ionicons from 'react-native-vector-icons/Ionicons';
import Monthly from './Monthly';
Choi Ga Young's avatar
Choi Ga Young committed
8
import Analy from './Analy';
9
import PostMoney from './PostMoney';
Soo Hyun Kim's avatar
Soo Hyun Kim committed
10
import MainScreen from './MainScreen';
Choi Ga Young's avatar
Choi Ga Young committed
11
import DetailInfo from './DetailInfo';
Test User's avatar
Test User committed
12

Choi Ga Young's avatar
Choi Ga Young committed
13
const Tab = createBottomTabNavigator();
Choi Ga Young's avatar
Choi Ga Young committed
14
const Stack = createStackNavigator();
Test User's avatar
Test User committed
15

Choi Ga Young's avatar
Choi Ga Young committed
16
function Home() {
Test User's avatar
Test User committed
17
  return (
Choi Ga Young's avatar
Choi Ga Young committed
18
19
20
    <Tab.Navigator screenOptions={({ route }) => ({
      tabBarIcon: ({ focused, color, size }) => {
        let iconName;
Test User's avatar
Test User committed
21

Choi Ga Young's avatar
Choi Ga Young committed
22
23
24
25
26
27
28
29
        if (route.name === 'Main') {
          iconName = focused
            ? 'home'
            : 'home-outline';
        } else if (route.name === 'Monthly') {
          iconName = focused ? 'calendar' : 'calendar-outline';
        } else if (route.name === 'Analy') {
          iconName = focused ? 'bar-chart' : 'bar-chart-outline';
30
        }
Choi Ga Young's avatar
Choi Ga Young committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
        // else if (route.name === 'Calendar') {
        //   iconName = focused ? 'calendar-sharp' : 'calendar-sharp';
        // }

        // You can return any component that you like here!
        return <Ionicons name={iconName} size={size} color={color} />;
      },
    })}
      tabBarOptions={{
        activeTintColor: 'skyblue',
        inactiveTintColor: 'gray',
      }}>
      <Tab.Screen name="Main" component={MainScreen} />
      <Tab.Screen name="Monthly" component={Monthly} />
      {/*<Tab.Screen name="Calendar" component={Calendar} />*/}
      <Tab.Screen name="Analy" component={Analy} />
      <Tab.Screen name="PostMoney" component={PostMoney} />
    </Tab.Navigator>
  )
}
Test User's avatar
Test User committed
51

Choi Ga Young's avatar
Choi Ga Young committed
52
53
54
55
function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
56
        <Stack.Screen options={{ headerShown: false }} name="Home" component={Home} />
Choi Ga Young's avatar
Choi Ga Young committed
57
58
        <Stack.Screen name="DetailInfo" component={DetailInfo} />
      </Stack.Navigator>
Choi Ga Young's avatar
Choi Ga Young committed
59
    </NavigationContainer>
Test User's avatar
Test User committed
60
  );
Choi Ga Young's avatar
Choi Ga Young committed
61
}
Test User's avatar
Test User committed
62

Choi Ga Young's avatar
Choi Ga Young committed
63
64
65
66
67
68
const style = StyleSheet.create({
  TextInput: {
    borderColor: 'skyblue',
    height: 40,
    margin: 12,
    borderWidth: 1
Test User's avatar
Test User committed
69
  },
Choi Ga Young's avatar
Choi Ga Young committed
70
71
  Font: {
    fontSize: 24
Choi Ga Young's avatar
Choi Ga Young committed
72
73
74
75
  },
  Contents: {
    justifyContent: "center",
    alignItems: "center",
Choi Ga Young's avatar
Choi Ga Young committed
76
    margin: 10
Choi Ga Young's avatar
Choi Ga Young committed
77
  }
Test User's avatar
Test User committed
78
79
});
export default App;