Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
rich-maker
Commits
8589b5b3
Commit
8589b5b3
authored
Aug 09, 2021
by
Choi Ga Young
Browse files
키보드 수정
parent
4cd275f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
UpdatePage.js
View file @
8589b5b3
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
StyleSheet
}
from
'
react-native
'
;
import
{
View
,
StyleSheet
,
Keyboard
,
TouchableWithoutFeedback
}
from
'
react-native
'
;
import
InputBox
from
'
./components/InputBox
'
;
import
ButtonsForm
from
'
./components/ButtonsForm
'
;
import
SelectForm
from
'
./components/SelectForm
'
;
...
...
@@ -83,8 +83,8 @@ function updatePage({ navigation, route }) {
const
deleteData
=
async
()
=>
{
try
{
if
(
selectedIndex
===
2
){
await
updateApi
.
delData
({
findId
:
[
route
.
params
[
1
].
id
,
route
.
params
[
1
].
id
+
1
]
})
if
(
selectedIndex
===
2
)
{
await
updateApi
.
delData
({
findId
:
[
route
.
params
[
1
].
id
,
route
.
params
[
1
].
id
+
1
]
})
}
else
{
await
updateApi
.
delData
({
findId
:
[
route
.
params
[
1
].
id
]
})
}
...
...
@@ -97,9 +97,9 @@ function updatePage({ navigation, route }) {
const
changeData
=
async
()
=>
{
try
{
if
(
selectedIndex
===
2
){
if
(
selectedIndex
===
2
)
{
await
updateApi
.
updateData
({
findId
:
route
.
params
[
1
].
id
},
[
date
,
contents
,
-
price
,
selected_cat
.
id
,
selected_subcat
.
id
,
selected_asset_type
.
id
,
selectedIndex
+
1
])
await
updateApi
.
updateData
({
findId
:
route
.
params
[
1
].
id
+
1
},
[
date
,
contents
,
price
,
selected_cat
.
id
,
selected_subcat
.
id
,
selected_deposit_asset_type
.
id
,
selectedIndex
+
1
])
await
updateApi
.
updateData
({
findId
:
route
.
params
[
1
].
id
+
1
},
[
date
,
contents
,
price
,
selected_cat
.
id
,
selected_subcat
.
id
,
selected_deposit_asset_type
.
id
,
selectedIndex
+
1
])
}
else
{
await
updateApi
.
updateData
({
findId
:
route
.
params
[
1
].
id
},
[
date
,
contents
,
price
,
selected_cat
.
id
,
selected_subcat
.
id
,
selected_asset_type
.
id
,
selectedIndex
+
1
])
}
...
...
@@ -121,83 +121,88 @@ function updatePage({ navigation, route }) {
navigation
.
goBack
()
}
return
(
<
View
>
<
View
>
{
selectedIndex
===
2
?
null
:
<
ButtonsForm
onPress
=
{(
index
)
=>
setSelectedIndex
(
index
)}
selectedIndex
=
{
selectedIndex
}
group
=
{[
"
수입
"
,
"
지출
"
]}
/>
}
<
DatePicker
inputTitle
=
"
날짜
"
date
=
{
date
}
setDate
=
{
setDate
}
/
>
<
InputBox
inputTitle
=
"
내용
"
value
=
{
contents
}
onChangeText
=
{
(
contents
)
=>
setContents
(
contents
)
}
maxLength
=
{
30
}
/
>
<
InputBox
inputTitle
=
"
금액
"
value
=
{
price
}
onChangeText
=
{
(
price
)
=>
setPrice
(
price
)
}
keyboardType
=
"
numeric
"
maxLength
=
{
30
}
/
>
<
SelectForm
inputTitle
=
{
selectedIndex
===
2
?
"
출금
"
:
"
자산
"
}
placeholder
=
"
자산 선택
"
data
=
{
asset_type
}
selectedData
=
{
selected_asset_type
}
onValueChange
=
{(
asset
)
=>
setSelected_asset_type
(
asset
)}
onUpdateDataPress
=
{
onUpdateAssetPress
}
/
>
{
selectedIndex
===
2
&&
<
TouchableWithoutFeedback
onPress
=
{()
=>
{
Keyboard
.
dismiss
();
}}
>
<
View
style
=
{{
flex
:
1
}}
>
<
View
>
{
selectedIndex
===
2
?
null
:
<
ButtonsForm
onPress
=
{(
index
)
=>
{
setSelectedIndex
(
index
);
Keyboard
.
dismiss
();
}}
selectedIndex
=
{
selectedIndex
}
group
=
{[
"
수입
"
,
"
지출
"
]}
/>
}
<
DatePicker
inputTitle
=
"
날짜
"
date
=
{
date
}
setDate
=
{
setDate
}
/
>
<
InputBox
inputTitle
=
"
내용
"
value
=
{
contents
}
onChangeText
=
{
(
contents
)
=>
setContents
(
contents
)
}
maxLength
=
{
30
}
/
>
<
InputBox
inputTitle
=
"
금액
"
value
=
{
price
}
onChangeText
=
{
(
price
)
=>
setPrice
(
price
)
}
keyboardType
=
"
numeric
"
maxLength
=
{
30
}
/
>
<
SelectForm
inputTitle
=
"
입금
"
inputTitle
=
{
selectedIndex
===
2
?
"
출금
"
:
"
자산
"
}
placeholder
=
"
자산 선택
"
data
=
{
asset_type
}
selectedData
=
{
selected_
deposit_
asset_type
}
onValueChange
=
{(
deposit_
asset
)
=>
setSelected_
deposit_
asset_type
(
deposit_
asset
)}
selectedData
=
{
selected_asset_type
}
onValueChange
=
{(
asset
)
=>
setSelected_asset_type
(
asset
)}
onUpdateDataPress
=
{
onUpdateAssetPress
}
/>
}
<
SelectForm
inputTitle
=
"
구분
"
placeholder
=
"
카테고리 선택
"
data
=
{
categories
}
selectedData
=
{
selected_cat
}
onValueChange
=
{(
cat
)
=>
setSelected_cat
(
cat
)}
subData
=
{
subcategories
}
selectedSubData
=
{
selected_subcat
}
onSubValueChange
=
{(
subcat
)
=>
setSelected_subcat
(
subcat
)}
onUpdateDataPress
=
{
onUpdateCatPress
}
/
>
<
/View
>
<
View
style
=
{
style
.
buttonRow
}
>
<
StyledButton
name
=
"
저장
"
onPress
=
{
changeData
}
style
=
{
style
.
submitButton
}
/
>
<
StyledButton
name
=
"
삭제
"
onPress
=
{
deleteData
}
style
=
{
style
.
delButton
}
/
>
<
StyledButton
name
=
"
취소
"
onPress
=
{()
=>
navigation
.
goBack
()}
style
=
{
style
.
cancelButton
}
/
>
/
>
{
selectedIndex
===
2
&&
<
SelectForm
inputTitle
=
"
입금
"
placeholder
=
"
자산 선택
"
data
=
{
asset_type
}
selectedData
=
{
selected_deposit_asset_type
}
onValueChange
=
{(
deposit_asset
)
=>
setSelected_deposit_asset_type
(
deposit_asset
)}
onUpdateDataPress
=
{
onUpdateAssetPress
}
/>
}
<
SelectForm
inputTitle
=
"
구분
"
placeholder
=
"
카테고리 선택
"
data
=
{
categories
}
selectedData
=
{
selected_cat
}
onValueChange
=
{(
cat
)
=>
setSelected_cat
(
cat
)}
subData
=
{
subcategories
}
selectedSubData
=
{
selected_subcat
}
onSubValueChange
=
{(
subcat
)
=>
setSelected_subcat
(
subcat
)}
onUpdateDataPress
=
{
onUpdateCatPress
}
/
>
<
/View
>
<
View
style
=
{
style
.
buttonRow
}
>
<
StyledButton
name
=
"
저장
"
onPress
=
{
changeData
}
style
=
{
style
.
submitButton
}
/
>
<
StyledButton
name
=
"
삭제
"
onPress
=
{
deleteData
}
style
=
{
style
.
delButton
}
/
>
<
StyledButton
name
=
"
취소
"
onPress
=
{()
=>
navigation
.
goBack
()}
style
=
{
style
.
cancelButton
}
/
>
<
/View
>
<
/View
>
<
/
View
>
<
/
TouchableWithoutFeedback
>
)
};
const
style
=
StyleSheet
.
create
({
...
...
components/Calendar.js
View file @
8589b5b3
...
...
@@ -104,10 +104,10 @@ function Calendar({
setMonth
(
month
+
1
)
}
}
useEffect
(()
=>
{
setMonth
(
todayM
)
setYear
(
todayY
)
},
[])
//
useEffect(() => {
//
setMonth(todayM)
//
setYear(todayY)
//
}, [])
const
onLayout
=
(
event
)
=>
{
const
{
x
,
y
,
height
,
width
}
=
event
.
nativeEvent
.
layout
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment