App.js 2.76 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
5
6
import { StyleSheet, View, Text, TextInput, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Ionicons from 'react-native-vector-icons/Ionicons';
import Monthly from './Monthly';
7
// import Analy from './Analy';
Choi Ga Young's avatar
Choi Ga Young committed
8
import Calendar from './Calendar';
9
import PostMoney from './PostMoney';
10
import InsertCat from './InsertCat';
Test User's avatar
Test User committed
11

Choi Ga Young's avatar
Choi Ga Young committed
12
function MainScreen({ navigation }) {
Choi Ga Young's avatar
Choi Ga Young committed
13
14
15
  const [number, onChangeNumber] = useState(null)
  const [totalAssets, setTotalAssets] = useState(0) //총 자산

Choi Ga Young's avatar
Choi Ga Young committed
16
17
18
  return (
    <>
      <View>
Choi Ga Young's avatar
Choi Ga Young committed
19
20
21
22
23
        <Text style={style.Font}>주간 캘린더 들어올 자리</Text>
        <View style={style.Contents}>
          <Text style={style.Font}> 자산</Text>
          <Text style={style.Font}>{totalAssets}</Text>
        </View>
Choi Ga Young's avatar
Choi Ga Young committed
24
25
        <TextInput
          style={style.TextInput}
Choi Ga Young's avatar
Choi Ga Young committed
26
          onChangeText={onChangeNumber}
Choi Ga Young's avatar
Choi Ga Young committed
27
28
29
30
31
32
33
          keyboardType="numeric"
        />
        <Text>입력한 숫자 보기: {number} </Text>
      </View>
      <Button
        title="월별 페이지로 이동"
        onPress={() => navigation.navigate('Monthly')}
Choi Ga Young's avatar
Choi Ga Young committed
34
      />
35
      <InsertCat />
Choi Ga Young's avatar
Choi Ga Young committed
36
37
38
    </> 
  )
}
Test User's avatar
Test User committed
39

Choi Ga Young's avatar
Choi Ga Young committed
40
const Tab = createBottomTabNavigator();
Test User's avatar
Test User committed
41

Choi Ga Young's avatar
Choi Ga Young committed
42
function App() {
Test User's avatar
Test User committed
43
  return (
Choi Ga Young's avatar
Choi Ga Young committed
44
45
    <NavigationContainer>
      <Tab.Navigator screenOptions={({ route }) => ({
Choi Ga Young's avatar
Choi Ga Young committed
46
47
        tabBarIcon: ({ focused, color, size }) => {
          let iconName;
Test User's avatar
Test User committed
48

Choi Ga Young's avatar
Choi Ga Young committed
49
50
51
52
53
54
55
56
57
58
59
          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';
          } else if (route.name === 'Calendar') {
            iconName = focused ? 'calendar-sharp':'calendar-sharp';
          }
Test User's avatar
Test User committed
60

Choi Ga Young's avatar
Choi Ga Young committed
61
62
63
64
          // You can return any component that you like here!
          return <Ionicons name={iconName} size={size} color={color} />;
        },
      })}
Choi Ga Young's avatar
Choi Ga Young committed
65
        tabBarOptions={{
Choi Ga Young's avatar
Choi Ga Young committed
66
          activeTintColor: 'skyblue',
Choi Ga Young's avatar
Choi Ga Young committed
67
68
69
70
          inactiveTintColor: 'gray',
        }}>
        <Tab.Screen name="Main" component={MainScreen} />
        <Tab.Screen name="Monthly" component={Monthly} />
Choi Ga Young's avatar
Choi Ga Young committed
71
        <Tab.Screen name="Calendar" component={Calendar} />
72
        <Tab.Screen name="Analy" component={PostMoney} />
Choi Ga Young's avatar
Choi Ga Young committed
73
74
      </Tab.Navigator>
    </NavigationContainer>
Test User's avatar
Test User committed
75
  );
Choi Ga Young's avatar
Choi Ga Young committed
76
}
Test User's avatar
Test User committed
77

Choi Ga Young's avatar
Choi Ga Young committed
78
79
80
81
82
83
const style = StyleSheet.create({
  TextInput: {
    borderColor: 'skyblue',
    height: 40,
    margin: 12,
    borderWidth: 1
Test User's avatar
Test User committed
84
  },
Choi Ga Young's avatar
Choi Ga Young committed
85
86
  Font: {
    fontSize: 24
Choi Ga Young's avatar
Choi Ga Young committed
87
88
89
90
91
  },
  Contents: {
    justifyContent: "center",
    alignItems: "center",
    margin:10
Choi Ga Young's avatar
Choi Ga Young committed
92
  }
Test User's avatar
Test User committed
93
94
});
export default App;