Commit 8589b5b3 authored by Choi Ga Young's avatar Choi Ga Young
Browse files

키보드 수정

parent 4cd275f1
import React, { useState, useEffect } from 'react'; 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 InputBox from './components/InputBox';
import ButtonsForm from './components/ButtonsForm'; import ButtonsForm from './components/ButtonsForm';
import SelectForm from './components/SelectForm'; import SelectForm from './components/SelectForm';
...@@ -83,8 +83,8 @@ function updatePage({ navigation, route }) { ...@@ -83,8 +83,8 @@ function updatePage({ navigation, route }) {
const deleteData = async () => { const deleteData = async () => {
try { try {
if (selectedIndex === 2){ if (selectedIndex === 2) {
await updateApi.delData({ findId: [route.params[1].id, route.params[1].id+1] }) await updateApi.delData({ findId: [route.params[1].id, route.params[1].id + 1] })
} else { } else {
await updateApi.delData({ findId: [route.params[1].id] }) await updateApi.delData({ findId: [route.params[1].id] })
} }
...@@ -97,9 +97,9 @@ function updatePage({ navigation, route }) { ...@@ -97,9 +97,9 @@ function updatePage({ navigation, route }) {
const changeData = async () => { const changeData = async () => {
try { 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 }, [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 { } else {
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 }, [date, contents, price, selected_cat.id, selected_subcat.id, selected_asset_type.id, selectedIndex + 1])
} }
...@@ -121,10 +121,13 @@ function updatePage({ navigation, route }) { ...@@ -121,10 +121,13 @@ function updatePage({ navigation, route }) {
navigation.goBack() navigation.goBack()
} }
return ( return (
<View> <TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();
}} >
<View style={{ flex: 1 }}>
<View> <View>
{selectedIndex === 2 ? null : <ButtonsForm {selectedIndex === 2 ? null : <ButtonsForm
onPress={(index) => setSelectedIndex(index)} onPress={(index) => { setSelectedIndex(index); Keyboard.dismiss(); }}
selectedIndex={selectedIndex} selectedIndex={selectedIndex}
group={["수입", "지출"]} />} group={["수입", "지출"]} />}
...@@ -197,7 +200,9 @@ function updatePage({ navigation, route }) { ...@@ -197,7 +200,9 @@ function updatePage({ navigation, route }) {
/> />
</View> </View>
</View> </View>
</TouchableWithoutFeedback>
) )
}; };
const style = StyleSheet.create({ const style = StyleSheet.create({
......
...@@ -104,10 +104,10 @@ function Calendar({ ...@@ -104,10 +104,10 @@ function Calendar({
setMonth(month + 1) setMonth(month + 1)
} }
} }
useEffect(() => { // useEffect(() => {
setMonth(todayM) // setMonth(todayM)
setYear(todayY) // setYear(todayY)
}, []) // }, [])
const onLayout = (event) => { const onLayout = (event) => {
const { x, y, height, width } = event.nativeEvent.layout; const { x, y, height, width } = event.nativeEvent.layout;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment