-
Notifications
You must be signed in to change notification settings - Fork 0
/
App1.js
110 lines (95 loc) · 2.31 KB
/
App1.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { Platform, StyleSheet, Text, View, KeyboardAvoidingView, TextInput, Button } from 'react-native';
//import { KeyboardAvoidingView, TextInput } from 'react-native-web';
import Task from './components/Task';
import {TouchableOpacity} from 'react-native';
export default function App() {
const [task, setTask] = React.useState();
const [taskItems, setTaskItems]= React.useState([]);
const handleAddTask = () =>{
setTaskItems([task,...taskItems])
setTask(null);
}
return (
<View style={styles.container}>
{/* Current Objectives*/}
<View style = {styles.tasksWrapper}>
<Text style={styles.sectionTitle}>Objectives</Text>
<View style = {styles.items}>
{/*This contains all tasks*/}
<Task text = {'test 1'}/>
</View>
<View style={styles.setter}>
<TextInput
style={styles.input}
value={task}
placeholder="Enter Goal"
onChangeText={text=> setTask(text)}
/>
{/*Button*/}
<View style={styles.button}>
<Button
onPress={() => handleAddTask()}
title= "Enter"
opacity= "0.5"
backgroundColor= "white"
/>
</View>
</View>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
backgroundColor: '#E8E5FD',
alignItems: 'center',
alignSelf: 'stretch'
},
tasksWrapper: {
paddingTop: 80,
flexDirection: 'column',
paddingHorizontal: 20,
},
writeTaskWrapper: {
position: 'absolute',
bottom: 60,
width: '100%',
justifyContent: 'space-between',
alignItems: 'center'
},
sectionTitle: {
fontSize: 32,
flex:1,
fontWeight: 'bold'
},
items: {
marginTop: 20,
flex:1
},
setter:{
flexDirection:'row',
flex: 1,
justifyContent:'space-between',
},
input:{
flex:15,
marginLeft:4,
paddingLeft:6,
borderColor:'black',
backgroundColor:"#FFEDED",
borderWidth: 2,
borderRadius:100
},
button:{
flex:1,
backgroundColor:'#FFEDED',
opacity:20,
borderWidth: 1,
borderRadius:200,
margin:3,
},
});