forked from ovaisahmed43/namaz-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-history.js
111 lines (98 loc) · 2.69 KB
/
page-history.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
import React, {
Component
} from 'react';
import {
StyleSheet,
ScrollView,
} from 'react-native';
import {
View,
Text,
Icon,
H1,
List,
ListItem,
} from 'native-base';
const styles = StyleSheet.create({
outerView: {
flex: 1,
flexDirection: 'column',
alignItems: 'center',
paddingVertical: 5,
paddingHorizontal: 15,
marginBottom: 1,
},
innerView: {
flex: 1,
flexDirection: 'row',
alignItems: 'center',
},
halfView: {
width: '50%',
},
halfViewText: {
color: '#ffffff',
fontSize: 25,
}
});
export default class HistoryPage extends Component {
static navigationOptions = {
header: null,
}
constructor(props) {
super(props);
this.state = {
isLoading: true,
namaz: []
}
}
componentDidMount() {
this.getNamazTimesFromApiAsync();
}
getNamazTimesFromApiAsync() {
fetch('https://muslimsalat.com/karachi/yearly.json')
.then((response) => response.json())
.then((response) => {
this.setState({
isLoading: false,
isError: false,
namaz: response.items,
});
})
.catch((error) => {
this.setState({
isLoading: false,
isError: true
});
Alert.alert(error);
});
}
render() {
return (
<ScrollView style={{ flex: 1, flexDirection: 'column', backgroundColor: 'rgba(255, 255, 255, 1.00)' }}>
<View style={[styles.colView, {
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(0,100,0,1)',
height: 150,
}]}>
<H1 style={styles.h1}>History</H1>
</View>
<List dataArray={this.state.namaz}
renderRow={(item) =>
<View style={[styles.outerView, {
backgroundColor: 'rgba(0,100,0,1)',
}]}>
<View style={styles.innerView}>
<Text style={styles.halfViewText}>{item.date_for}</Text>
</View>
<View style={styles.innerView}>
<Text>{item.fajr} {item.dhuhr}</Text>
</View>
</View>
}>
</List>
</ScrollView >
);
}
}