Fix menu bug
This commit is contained in:
+16
-16
@@ -1,12 +1,26 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import {
|
import {
|
||||||
View,
|
View,
|
||||||
Text
|
Text,
|
||||||
|
TouchableOpacity
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import styles, { iconStyles } from '../styles'
|
import styles, { iconStyles } from '../styles'
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons'
|
||||||
|
|
||||||
export default class Menu extends Component {
|
export default class Menu extends Component {
|
||||||
|
makeMenuItem({ title, icon, componentName }) {
|
||||||
|
return (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => this.props.navigate(componentName)}
|
||||||
|
style={{ alignItems: 'center' }}
|
||||||
|
>
|
||||||
|
<Icon name={icon} {...iconStyles.menuIcon} />
|
||||||
|
<Text style={styles.menuText}>
|
||||||
|
{title}
|
||||||
|
</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
)
|
||||||
|
}
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
this.props.symptomView ?
|
this.props.symptomView ?
|
||||||
@@ -19,22 +33,8 @@ export default class Menu extends Component {
|
|||||||
{title: 'Chart', icon: 'chart-line', componentName: 'Chart'},
|
{title: 'Chart', icon: 'chart-line', componentName: 'Chart'},
|
||||||
{title: 'Stats', icon: 'chart-pie', componentName: 'Stats'},
|
{title: 'Stats', icon: 'chart-pie', componentName: 'Stats'},
|
||||||
{title: 'Settings', icon: 'settings', componentName: 'Settings'},
|
{title: 'Settings', icon: 'settings', componentName: 'Settings'},
|
||||||
].map(makeMenuItem)}
|
].map(this.makeMenuItem.bind(this))}
|
||||||
</View >
|
</View >
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeMenuItem({title, icon, componentName}) {
|
|
||||||
return (
|
|
||||||
<View style={{alignItems: 'center'}}>
|
|
||||||
<Icon name={icon} {...iconStyles.menuIcon}/>
|
|
||||||
<Text
|
|
||||||
style={styles.menuText}
|
|
||||||
onPress={() => this.props.navigate(componentName)}
|
|
||||||
>
|
|
||||||
{title}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ import {
|
|||||||
import Share from 'react-native-share'
|
import Share from 'react-native-share'
|
||||||
import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker'
|
import { DocumentPicker, DocumentPickerUtil } from 'react-native-document-picker'
|
||||||
import rnfs from 'react-native-fs'
|
import rnfs from 'react-native-fs'
|
||||||
import Header from './header'
|
|
||||||
import styles from '../styles/index'
|
import styles from '../styles/index'
|
||||||
import { settings as labels } from './labels'
|
import { settings as labels } from './labels'
|
||||||
import getDataAsCsvDataUri from '../lib/import-export/export-to-csv'
|
import getDataAsCsvDataUri from '../lib/import-export/export-to-csv'
|
||||||
@@ -19,7 +18,6 @@ export default class Settings extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Header title='Settings'/>
|
|
||||||
<View style={styles.homeButtons}>
|
<View style={styles.homeButtons}>
|
||||||
<View style={styles.homeButton}>
|
<View style={styles.homeButton}>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ export default class Stats extends Component {
|
|||||||
const statsText = determineStatsText(allMensesStarts)
|
const statsText = determineStatsText(allMensesStarts)
|
||||||
return (
|
return (
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<Header title='Statistics' />
|
|
||||||
<View>
|
<View>
|
||||||
<Text style={styles.stats}>{statsText}</Text>
|
<Text style={styles.stats}>{statsText}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user