-
Notifications
You must be signed in to change notification settings - Fork 6
/
Diseases.js
executable file
·68 lines (51 loc) · 1.82 KB
/
Diseases.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
import React from 'react';
import { StyleSheet, View, Text, ScrollView, Dimensions, StatusBar } from 'react-native';
import { Button } from 'native-base';
import I18n from './locales/i18n.js';
var object = require('./locales/en.json');
const { height } = Dimensions.get('window');
export default class DiseasesScreen extends React.PureComponent {
static navigationOptions = () => ({
title: 'Healthy Host',
headerTintColor: 'white',
headerBackTitle: "Back",
headerStyle: {
backgroundColor: 'royalblue'
}
});
state = {
screenHeight: height,
};
onContentSizeChange = (contentWidth, contentHeight) => {
this.setState({ screenHeight: contentHeight });
};
makeList = () => {
Output = []
var objectSize = Object.keys(object.Text.Diseases_Menu_Choices).length;
for (var i = 0; i < objectSize; i++) {
let idx = i;
Output.push(<Button key={idx} onPress={() => { this.props.navigation.navigate('Diseases_Info', { disease: I18n.t('Text.Diseases_Menu_Choices.' + idx), }) }} style={{ backgroundColor: '#DCDCDC', alignSelf: "center", width: '80%', justifyContent: "center", margin: 10, borderRadius: 15 }}><Text style={{ color: 'black', fontSize: 20 }}>{I18n.t('Text.Diseases_Menu_Choices.' + idx)}</Text></Button>);
}
return Output;
}
render() {
return (
<ScrollView style={{ flex: 1 }} contentContainerStyle={styles.scrollview} scrollEnabled={true} onContentSizeChange={this.onContentSizeChange}>
<StatusBar barStyle="light-content" />
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
{this.makeList()}
</View>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
scrollview: {
flexGrow: 1,
},
content: {
flexGrow: 1,
justifyContent: "space-between",
padding: 10,
},
});