InfoDetails.js 2.84 KB
Newer Older
YoonDongMin's avatar
YdM    
YoonDongMin committed
1
2
import React, { useEffect, useState } from 'react';
import { StyleSheet, View, Text, Button, Pressable, TouchableWithoutFeedback, Keyboard } from 'react-native';
YoonDongMin's avatar
DongM    
YoonDongMin committed
3
import { globalStyles } from '../styles/global';
YoonDongMin's avatar
YdM    
YoonDongMin committed
4
5
import InputBox from '../components/InputBox';
import StyledButton from '../components/StyledButton';
YoonDongMin's avatar
DongM    
YoonDongMin committed
6
7


YoonDongMin's avatar
YdM    
YoonDongMin committed
8
9
10
11
12
13
14
15
16
17
18
function InfoDetails({ route }) {
    const [date, setDate] = useState('')
    const [person, setPerson] = useState('')
    const [money, setMoney] = useState('')
    const [remained_money, setRemained_money] = useState('')
    useEffect(() => {
        setDate(route.params?.date)
        setPerson(route.params?.person)
        setMoney(route.params?.money)
        setRemained_money(route.params?.remained_money)
    }, [])
YoonDongMin's avatar
DongM    
YoonDongMin committed
19
20

    return (
YoonDongMin's avatar
YdM    
YoonDongMin committed
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
        <TouchableWithoutFeedback onPress={() => {
            Keyboard.dismiss();
        }}>
            <View style={{ flex: 1 }}>
                <View>
                    <InputBox
                        inputTitle="날짜"
                        value={date}
                        onChangeText={
                            (date) => setDate(date)
                        }
                    />
                    <InputBox
                        inputTitle="누구에게"
                        value={person}
                        onChangeText={
                            (person) => setPerson(person)
                        }
                    />
                    <InputBox
                        inputTitle="금액"
                        value={money}
                        onChangeText={
                            (money) => setMoney(money)
                        }
                    />
                    <InputBox
                        inputTitle="남은 금액"
                        value={remained_money}
                        onChangeText={
                            (remaied_money) => setRemained_money(remained_money)
                        }
                    />
                </View>
                <View style={style.buttonRow}>
                    <StyledButton
                        name="수정"
                        onPress={() => console.log('수정버튼')}
                        style={style.submitButton}
                    />
                    <StyledButton
                        name="저장"
                        onPress={() => console.log('취소버튼')}
                        style={style.cancelButton}
                    />
                </View>
            </View>
        </TouchableWithoutFeedback>
YoonDongMin's avatar
DongM    
YoonDongMin committed
69
70
71
72
    )
}


YoonDongMin's avatar
YdM    
YoonDongMin committed
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

const style = StyleSheet.create({

    buttonRow: {
        flexDirection: 'row',
        alignItems: "center",
        marginHorizontal: 10,
        marginVertical: 3,
    },
    submitButton: {
        flex: 1,
        height: 50,
    },
    cancelButton: {
        flex: 1,
        height: 50,
    }
});




export default InfoDetails;