-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddModal.js
86 lines (77 loc) · 2.56 KB
/
AddModal.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from 'react';
import { Text, StyleSheet, TouchableOpacity, Modal, KeyboardAvoidingView, TextInput } from 'react-native';
import DateTimePickerModal from "react-native-modal-datetime-picker";
import Icon from 'react-native-vector-icons/MaterialIcons';
const AddModal = (props) => {
return (
<Modal
animationType="fade"
statusBarTranslucent={true}
visible={props.addTaskModal}
onRequestClose={() => {props.setAddTaskModal(false); props.setDefaultStates();}}
>
<KeyboardAvoidingView
behavior={Platform.OS === "ios" ? "padding" : "height"}
style={styles.modalContainer}
>
<Text style={styles.sectionTitle}>Add Task</Text>
<TextInput style={styles.input} placeholder={'Task Name'} value={props.task} onChangeText={text => props.setTask(text)} />
<TouchableOpacity color="#f194ff" style={[styles.buttonStyle, {backgroundColor: "#FFF"}]} onPress={() => props.setDatePickerVisibility(true)}>
<Text>{props.date.slice(0, 3) + "," + props.date.slice(3, 10) + "," + props.date.slice(10)}</Text>
</TouchableOpacity>
<DateTimePickerModal
isVisible={props.isDatePickerVisible}
mode="date"
onConfirm={props.handleDateConfirm}
onCancel={() => props.setDatePickerVisibility(false)}
/>
<TouchableOpacity style={[styles.buttonStyle, {backgroundColor: props.color}]} onPress={() => props.setColorPickerModal(true)}>
<Text>Task Color</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.addTaskWrapper} onPress={() => props.handleAddTask()}>
<Icon style={styles.sectionTitle} name="save"/>
</TouchableOpacity>
</KeyboardAvoidingView>
</Modal>
)
}
const styles = StyleSheet.create({
modalContainer: {
flex: 1,
paddingHorizontal: 20,
justifyContent: 'center',
},
sectionTitle: {
fontSize: 25,
fontWeight: 'bold'
},
input: {
marginTop: 15,
paddingVertical: 15,
paddingHorizontal: 20,
color: '#000',
borderWidth: 1,
borderRadius: 30,
borderColor: '#C0C0C0',
},
buttonStyle: {
marginTop: 20,
paddingVertical: 15,
paddingHorizontal: 20,
borderRadius: 30,
elevation: 5,
},
addTaskWrapper: {
position: 'absolute',
alignItems: 'center',
justifyContent: 'center',
width: 60,
height: 60,
bottom: 40,
right: 40,
backgroundColor: '#FFF',
borderRadius: 60,
elevation: 5,
},
});
export default AddModal;