-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMarkAtt.js
118 lines (102 loc) · 2.88 KB
/
MarkAtt.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
111
112
113
114
115
116
117
118
import React, { Component } from 'react';
import Button from 'react-native-button';
import StudentRow from './StudentRow';
import DatePicker from 'react-native-datepicker';
import firebase from 'firebase';
let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
import {
AppRegistry,
StyleSheet,
Text,
View,
Navigator,
ListView,
Picker,
TouchableNativeFeedback,
ToastAndroid
} from 'react-native';
class MarkAtt extends Component{
constructor(props) {
super(props);
this.state={
dataSource: ds.cloneWithRows([]),
date: ''
}
}
componentDidMount() {
fetch('https://reportbee-cf27a.firebaseio.com/students.json')
.then(
function(response){
response.json().then(function(data) {
this.setState({
dataSource: ds.cloneWithRows(data)
})
}.bind(this));
}.bind(this))
.catch((error) => {
console.error(error);
});
}
_renderRow(rowData) {
return (<StudentRow student={rowData} date={this.state.date}/> )
}
markAttendance() {
}
render() {
return (
<View style={{ marginTop:60 }}>
<DatePicker
style={{width: 200}}
date={this.state.date}
mode="date"
placeholder="select date"
format="YYYY-MM-DD"
minDate="2016-06-01"
maxDate="2017-06-01"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
customStyles={{
dateIcon: {
position: 'absolute',
left: 0,
top: 4,
marginLeft: 0
},
dateInput: {
marginLeft: 36
},
}}
onDateChange={(date) => {this.setState({date: date})}}
/>
<ListView
dataSource={this.state.dataSource}
renderRow={this._renderRow.bind(this)} enableEmptySections={true}
/>
<Button
containerStyle={{padding:10, marginTop:20, height:45, overflow:'hidden', borderRadius:4, backgroundColor: 'green'}}
style={{fontSize: 20, color: 'white'}}
onPress= {() => this._save()}>
Submit
</Button>
</View>
);
}
_save() {
ToastAndroid.show('Saved!', ToastAndroid.SHORT);
this._navigate("Home");
}
_navigate(name) {
this.props.navigator.push({
name:name
})
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
}
})
module.exports = MarkAtt;