Commit 3912238f authored by YoonDongMin's avatar YoonDongMin
Browse files

0808DM

parent ff89d354
import React, {useState} from 'react';
import React, { useState } from 'react';
import { View, Text, TextInput, StyleSheet, Button, Keyboard, TouchableWithoutFeedback, Modal } from 'react-native';
import { SpeedDial } from 'react-native-elements';
import WeeklyCalendar from './components/WeeklyCalendar';
......@@ -36,15 +36,18 @@ function MainScreen({ navigation }) {
title="월별 페이지로 이동"
onPress={() => navigation.navigate('Monthly')}
/>
<SpeedDial
isOpen={open}
icon={{ name: 'edit', color: '#fff' }} //연필모양
openIcon={{ name: 'close', color: '#fff' }} //x모양
icon={{ name: 'edit', color: '#fff', backgroundcolor: 'skyblue' }} //연필모양
openIcon={{ name: 'close', color: '#fff', backgroundcolor: 'orange' }} //x모양
onOpen={() => setOpen(!open)}
onClose={() => setOpen(!open)}
>
<SpeedDial.Action
icon={{ name: 'add', color: '#fff' }}
icon={{ name: 'add', color: 'white' }}
title="부채"
onPress={() => navigation.navigate('DeptPage')}
/>
......
......@@ -7,7 +7,6 @@ import memoApi from './db/memoPage.api';
function MemoPage({ navigation }) {
const [memos, setMemos] = useState([])
const [selectedIndex, setSelectedIndex] = useState(0)
const [modalOpen, setModalOpen] = useState(false);
const loadMemos = async () => {
......
import React, { useState } from "react";
import { Button, View, Text, StyleSheet, Pressable } from "react-native";
import DateTimePickerModal from "react-native-modal-datetime-picker";
import { getDateStr } from '../utils/dateFunction';
const DatePicker = (props) => {
const [isDatePickerVisible, setDatePickerVisibility] = useState(false);
......@@ -14,8 +14,8 @@ const DatePicker = (props) => {
};
const handleConfirm = (date) => {
console.log("A date has been picked: ", String(date.toJSON()).split(/T/)[0]);
props.setDate(String(date.toJSON()).split(/T/)[0])
console.log("A date has been picked: ", getDateStr(date));
props.setDate(getDateStr(date))
hideDatePicker();
};
......
......@@ -5,14 +5,15 @@ import InputBox from '../components/InputBox';
import StyledButton from '../components/StyledButton';
import DatePicker from '../components/DatePicker.js';
import deptApi from '../db/deptPage.api';
import { getDateStr } from '../utils/dateFunction';
function DeptDetails({ route, navigation }) {
const { item, loadLoan } = route.params
const getDate = () => {
var date = new Date();
return (String(date.toJSON()).split(/T/)[0])
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
const [date, setDate] = useState(getDate())
const [date, setDate] = useState(getDates())
const [message, setMessage] = useState('')
const [money, setMoney] = useState('')
const [remained_money, setRemained_money] = useState('')
......
......@@ -5,6 +5,7 @@ import { Formik } from 'formik';
import * as yup from 'yup';
import DatePicker from '../components/DatePicker.js';
import InputBox from '../components/InputBox';
import { getDateStr } from '../utils/dateFunction';
const ReviewSchema = yup.object({
date: yup.string() //string만 받는다
......@@ -18,11 +19,11 @@ const ReviewSchema = yup.object({
.required()
})
const getDate = () => {
var date = new Date();
return (String(date.toJSON()).split(/T/)[0])
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
// const [date, setDate] = useState(getDate())
function DeptForm({ addInfo }) {
return (
......@@ -45,7 +46,7 @@ function DeptForm({ addInfo }) {
<DatePicker
inputTitle='날짜'
date={values.date || getDate()}//오늘날짜 아니면 바뀐날짜
date={values.date || getDates()}//오늘날짜 아니면 바뀐날짜
setDate={handleChange('date')}
/>
<InputBox
......
......@@ -5,15 +5,15 @@ import InputBox from '../components/InputBox';
import StyledButton from '../components/StyledButton';
import DatePicker from '../components/DatePicker.js';
import memoApi from '../db/memoPage.api';
import { getDateStr } from '../utils/dateFunction';
function MemoDetails({ route, navigation }) {
const {item, loadMemos} = route.params
const getDate = () => {
var date = new Date();
return (String(date.toJSON()).split(/T/)[0])
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
const [date, setDate] = useState(getDate())
const [date, setDate] = useState(getDates())
const [message, setMessage] = useState('')
const onUpdateHandle = async () => {
await memoApi.updateMemo({ date, message }, item.id)
......
......@@ -5,20 +5,21 @@ import { Formik } from 'formik';
import * as yup from 'yup';
import DatePicker from '../components/DatePicker.js';
import InputBox from '../components/InputBox.js';
import { getDateStr } from '../utils/dateFunction';
const ReviewSchema = yup.object({
// date: yup.string() //string만 받는다
// .required() //아무것도 입력안했하면 안받음
// , //최소4글짜
date: yup.string() //string만 받는다
.required(),
message: yup.string()
.required()
.min(2),
})
const getDate = () => {
var date = new Date();
return (String(date.toJSON()).split(/T/)[0])
const getDates = () => {
const date = new Date();
return (getDateStr(date))
}
......@@ -41,7 +42,7 @@ function MemoForm({ addInfo }) {
<View>
<DatePicker
inputTitle='날짜'
date={values.date || getDate()}//오늘날짜 아니면 바뀐날짜
date={values.date || getDates()}//오늘날짜 아니면 바뀐날짜
setDate={handleChange('date')}
/>
<InputBox
......
export function getDate(item) {
export function getDateStr(item) {
let date = ''
if (item) {
date = new Date(item)
......
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