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

키보드 수정

parent 4cd275f1
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,10 +121,13 @@ function updatePage({ navigation, route }) {
navigation.goBack()
}
return (
<View>
<TouchableWithoutFeedback onPress={() => {
Keyboard.dismiss();
}} >
<View style={{ flex: 1 }}>
<View>
{selectedIndex === 2 ? null : <ButtonsForm
onPress={(index) => setSelectedIndex(index)}
onPress={(index) => { setSelectedIndex(index); Keyboard.dismiss(); }}
selectedIndex={selectedIndex}
group={["수입", "지출"]} />}
......@@ -197,7 +200,9 @@ function updatePage({ navigation, route }) {
/>
</View>
</View>
</TouchableWithoutFeedback>
)
};
const style = StyleSheet.create({
......
......@@ -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;
......
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