-
Notifications
You must be signed in to change notification settings - Fork 6
/
Clinics.js
70 lines (54 loc) · 1.67 KB
/
Clinics.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
import React from 'react';
import { TouchableOpacity, FlatList, StyleSheet, Text, View } from 'react-native';
var object = require('./locales/en.json');
import I18n from './locales/i18n.js';
function Item({ id, title, onSelect }) {
return (
<TouchableOpacity onPress={() => onSelect(id)} style={styles.item}>
<Text style={styles.title}>{title}</Text>
</TouchableOpacity>
);
}
export default class ClinicsScreen extends React.Component {
static navigationOptions = () => ({
title: 'Healthy Host',
headerTintColor: 'white',
headerBackTitle: "Back",
headerStyle: {
backgroundColor: 'royalblue'
}
});
makeList = () => {
var DATA = [];
Output = []
var objectSize = Object.keys(object.Clinics).length;
for (var i = 0; i < objectSize; i++) {
var string = I18n.t('Clinics.' + i + '.Name');
var num = i + 1;
var n = num.toString();
DATA.push({ id: n, title: string });
}
Output.push(<FlatList key={0} data={DATA} renderItem={({ item }) => (<Item id={item.id} title={item.title} onSelect={() => this.props.navigation.navigate('Medical Clinics', { index: parseInt(item.id), })} />)} />);
return Output;
}
render() {
return (
<View>
{this.makeList()}
</View>
);
}
}
const styles = StyleSheet.create({
item: {
backgroundColor: '#DCDCDC',
marginVertical: 8,
marginHorizontal: 20,
padding: 10,
borderRadius: 15
},
title: {
color: '#000000',
fontSize: 20
},
});