-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditMeetting.js
More file actions
116 lines (112 loc) · 4.34 KB
/
EditMeetting.js
File metadata and controls
116 lines (112 loc) · 4.34 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
111
112
113
114
115
116
import React, { Component } from 'react';
import {
AppRegistry, FlatList, StyleSheet, Text, View, Image, 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 EditMeeting extends Component {
constructor(props) {
super(props);
this.state = {
name: '',
foodDescription: ''
};
}
showEditMeeting = (edittingName, flatlistItem) => {
// console.log(`edittingName = ${JSON.stringify(edittingName)}`);
this.setState({
key: edittingName.key,
name: edittingName.name,
foodDescription: edittingName.foodDescription,
flatlistItem: flatlistItem
});
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
}}>Information of Meeting</Text>
<TextInput
style={{
height: 40,
borderBottomColor: 'gray',
marginLeft: 30,
marginRight: 30,
marginTop: 20,
marginBottom: 10,
borderBottomWidth: 1
}}
onChangeText={(text) => this.setState({ name: text })}
placeholder="Enter your metting "
value={this.state.name}
/>
<TextInput
style={{
height: 40,
borderBottomColor: 'gray',
marginLeft: 30,
marginRight: 30,
marginTop: 10,
marginBottom: 20,
borderBottomWidth: 1
}}
onChangeText={(text) => this.setState({ foodDescription: text })}
placeholder="Enter the description"
value={this.state.foodDescription}
/>
<Button
style={{ fontSize: 18, color: 'white' }}
containerStyle={{
padding: 8,
marginLeft: 70,
marginRight: 70,
height: 40,
borderRadius: 6,
backgroundColor: 'mediumseagreen'
}}
onPress={() => {
if (this.state.name.length == 0 || this.state.foodDescription.length == 0) {
alert("You must enter metting and description");
return;
}
//Update existing Food
var foundIndex = flatListData.findIndex(item => this.state.key == item.key);
if (foundIndex < 0) {
return;
}
flatListData[foundIndex].name = this.state.name;
flatListData[foundIndex].foodDescription = this.state.foodDescription;
this.state.flatlistItem.refreshFlatListItem();
this.refs.myModal.close();
}}>
Save
</Button>
</Modal>
);
}
}