Skip to content

Commit

Permalink
Merge pull request #228 from dhruv036/homeScreenEnhance
Browse files Browse the repository at this point in the history
Home screen enhance
  • Loading branch information
shreya-mishra authored Sep 3, 2023
2 parents ef5a7ac + 122545d commit 4fe7e8a
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/components/OOO/OOOForm.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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
Expand All @@ -12,20 +13,25 @@ const OOOForm = ({
handleFormSubmit,
isLoading,
}: 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 @@ -57,6 +63,7 @@ const styles = StyleSheet.create({
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;

0 comments on commit 4fe7e8a

Please sign in to comment.