-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddMett.js
More file actions
110 lines (105 loc) · 3.98 KB
/
AddMett.js
File metadata and controls
110 lines (105 loc) · 3.98 KB
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 React, { Component } from 'react';
import {
AppRegistry, FlatList, StyleSheet, Text, View, Alert,
Platform, TouchableHighlight, Dimensions,
TextInput
} from 'react-native';
import Modal from 'react-native-modalbox';
import Button from 'react-native-button';
import flatListData from './FlatListData';
var screen = Dimensions.get('window');
export default class AddMett extends Component {
constructor(props) {
super(props);
this.state = {
newName: '',
newDescription: '',
};
}
showAddMett = () => {
this.refs.myModal.open();
}
generateKey = (numberOfCharacters) => {
return require('random-string')({length: numberOfCharacters});
}
render() {
return (
<Modal
ref={"myModal"}
style={{
justifyContent: 'center',
borderRadius: Platform.OS === 'ios' ? 30 : 0,
shadowRadius: 10,
width: screen.width - 80,
height: 280
}}
position='center'
backdrop={true}
onClosed={() => {
}}
>
<Text style={{
fontSize: 16,
fontWeight: 'bold',
textAlign: 'center',
marginTop: 40
}}>New meeting's information</Text>
<TextInput
style={{
height: 40,
borderBottomColor: 'gray',
marginLeft: 30,
marginRight: 30,
marginTop: 20,
marginBottom: 10,
borderBottomWidth: 1
}}
onChangeText={(text) => this.setState({ newName: text })}
placeholder="Enter metting's name "
value={this.state.newName}
/>
<TextInput
style={{
height: 40,
borderBottomColor: 'gray',
marginLeft: 30,
marginRight: 30,
marginTop: 10,
marginBottom: 20,
borderBottomWidth: 1
}}
onChangeText={(text) => this.setState({ newFoodDescription: text })}
placeholder="Enter new food's description of Metting"
value={this.state.newFoodDescription}
/>
<Button
style={{ fontSize: 18, color: 'white' }}
containerStyle={{
padding: 8,
marginLeft: 70,
marginRight: 70,
height: 40,
borderRadius: 6,
backgroundColor: 'mediumseagreen'
}}
onPress={() => {
if (this.state.newName.length == 0 || this.state.newDescription.length == 0) {
alert("You must enter the plan and description of metting");
return;
}
const newKey = this.generateKey(24);
const newName = {
key: newKey,
name: this.state.newName,
description: this.state.newDescription
};
flatListData.push(newName);
this.props.parentFlatList.refreshFlatList(newKey);
this.refs.myModal.close();
}}>
Save
</Button>
</Modal>
);
}
}