-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackup.js
68 lines (56 loc) · 2.79 KB
/
backup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const PostEvent = () =>{
//Omitted code for brevity.
return(
<Formik
initialValues ={{user: userName.currentUser.displayName, description: '',datePosted: new Date(), location: '', eventDate: '', title: ''}}
onSubmit ={(values, {resetForm}) =>{
firebase.firestore().collection('PostedFunEvents').add({
datePosted: values.datePosted.toDateString(),
description: values.description,
eventDate: date.toDateString(),
eventTime: date.toTimeString(),
location: values.location,
title: values.title,
user: firebase.auth().currentUser.displayName,
userId : firebase.auth().currentUser.uid
});
resetForm({values:''})
}}>
{props =>(
<ScrollView keyboardShouldPersistTaps='always'>
<DismissKeyBoard>
<View style={{flex:1}}>
<View style={styles.form}><Text style={styles.text}>Pick a place for the event</Text></View>
<View style= {{paddingTop:20}}>
<GoogleAutocomplete
placeholder = 'Insert place to post about '
onPress={(data, details = null) => {
{props.values.location = data.description}
}}>
</GoogleAutocomplete>
</View >
<View style={styles.form}>
<Text style={styles.text}>{userName.currentUser.displayName}</Text>
<TextInput
placeholder= 'Title of the event'
onChangeText = {props.handleChange('title')}
style={styles.text}/>
<TextInput
placeholder= 'Description (e.g This is located...)'
multiline={true}
onChangeText = {props.handleChange('description')}
values = {props.values.description}
style={styles.textBox}/>
<Text style={styles.text} >Click on the below icons to pick a time and a date for the event</Text>
<DateTimeImage onPress={showTimepicker} name = 'alarm'>Time?</DateTimeImage>
<DateTimeImage onPress={showDatepicker} name = 'calendar'>Date?</DateTimeImage>
{show && (<DateTimePicker onChange={onChange} value = {date} mode = {mode}></DateTimePicker>)}
<Button onPress={props.handleSubmit}>Submit</Button>
</View>
</View>
</DismissKeyBoard>
</ScrollView>
)}
</Formik>
)
}