Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Home screen enhance #228

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions src/components/OOO/OOOForm.tsx
sahsisunny marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
import { StyleSheet, TextInput, View, Button } from 'react-native';
import React from 'react';
import { StyleSheet, TextInput, View, Button} from 'react-native';
import React, {useState} from 'react';

Check failure on line 2 in src/components/OOO/OOOForm.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'useState' is defined but never used
import { OOOFormType } from './OOOFormType';
import DatePicker from './OOOFormDatePicker';

const OOOForm = ({
fromDate,

Check failure on line 7 in src/components/OOO/OOOForm.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'fromDate' is defined but never used. Allowed unused args must match /^_/u
toDate,

Check failure on line 8 in src/components/OOO/OOOForm.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'toDate' is defined but never used. Allowed unused args must match /^_/u
description,
setToDate,

Check failure on line 10 in src/components/OOO/OOOForm.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'setToDate' is defined but never used. Allowed unused args must match /^_/u
setFromDate,

Check failure on line 11 in src/components/OOO/OOOForm.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'setFromDate' is defined but never used. Allowed unused args must match /^_/u
setDescription,
handleFormSubmit,
}: OOOFormType) => {
// const [selectedDate, setSelectedDate] = useState(new Date());
// const handleDateChange = (event, date) => {
// if (date !== undefined) {
// setSelectedDate(date);
// }
// };


return (
<View style={styles.formContainer}>
<TextInput
style={styles.input}
placeholder="From Date"
value={fromDate}
onChangeText={setFromDate}
/>
<TextInput
<DatePicker name='From date' />
<DatePicker name='To date'/>

{/* <TextInput
style={styles.input}
placeholder="To Date"
value={toDate}
onChangeText={setToDate}
/>
/> */}
<TextInput
style={[styles.input, styles.textArea]}
placeholder="Description"
Expand Down Expand Up @@ -56,6 +62,7 @@
borderWidth: 1,
borderRadius: 4,
marginBottom: 10,
marginTop:20,
paddingHorizontal: 10,
},
textArea: {
Expand Down
61 changes: 61 additions & 0 deletions src/components/OOO/OOOFormDatePicker.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState,prop } from 'react';

Check failure on line 1 in src/components/OOO/OOOFormDatePicker.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

'prop' is defined but never used
import { Text, TouchableOpacity, StyleSheet, ScrollView } from 'react-native';
import DatePicker from 'react-native-date-picker';

type CatProps = {
name: string;
};

const DeadLineDatePicker = (props : CatProps) => {
const [date, setDate] = useState(new Date());
const [open, setOpen] = useState(false);

return (
<ScrollView>
<TouchableOpacity
style={styles.buttonStyle}
onPress={() => setOpen(true)}
>
<Text style={styles.buttonTextStyle}>{props.name}</Text>
</TouchableOpacity>
<DatePicker
modal
mode="date"
open={open}
date={date}
onConfirm={() => {
setOpen(false);
setDate(date);
}}
onCancel={() => {
setOpen(false);
}}
/>
</ScrollView>
);
};

const styles = StyleSheet.create({
buttonStyle: {
width: '100%',
height: 50,
elevation: 5,
borderRadius: 10,
borderWidth: 1,
backgroundColor: 'white',
alignSelf: 'center',
marginTop: 10,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
paddingLeft: 15,
paddingRight: 15,
},
buttonTextStyle: {
fontWeight: '600',
color: 'black',
justifyContent: 'center',
},
});

export default DeadLineDatePicker;
Loading