Merge branch '138-indicate-active-menu-item' into 'master'
Resolve "indicate active menu item" Closes #138 See merge request bloodyhealth/drip!108
This commit is contained in:
+3
-1
@@ -56,7 +56,8 @@ export default class App extends Component {
|
|||||||
if (this.state.currentPage === 'Home') return false
|
if (this.state.currentPage === 'Home') return false
|
||||||
if (isSymptomView(this.state.currentPage)) {
|
if (isSymptomView(this.state.currentPage)) {
|
||||||
this.navigate(
|
this.navigate(
|
||||||
this.originForSymptomView, { cycleDay: this.state.currentProps.cycleDay }
|
this.originForSymptomView,
|
||||||
|
{ cycleDay: this.state.currentProps.cycleDay }
|
||||||
)
|
)
|
||||||
} else if(this.state.currentPage === 'CycleDay') {
|
} else if(this.state.currentPage === 'CycleDay') {
|
||||||
this.navigate(this.menuOrigin)
|
this.navigate(this.menuOrigin)
|
||||||
@@ -93,6 +94,7 @@ export default class App extends Component {
|
|||||||
<Menu
|
<Menu
|
||||||
navigate={this.navigate}
|
navigate={this.navigate}
|
||||||
titles={menuTitlesLowerCase}
|
titles={menuTitlesLowerCase}
|
||||||
|
currentPage={this.state.currentPage}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
+5
-3
@@ -4,19 +4,21 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TouchableOpacity
|
TouchableOpacity
|
||||||
} from 'react-native'
|
} from 'react-native'
|
||||||
import styles, { iconStyles } from '../styles'
|
import styles, { iconStyles, secondaryColor } 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, onPress}, i) => {
|
makeMenuItem = ({ title, icon, onPress}, i) => {
|
||||||
|
const styleActive = (this.props.currentPage.toLowerCase() === title) ?
|
||||||
|
{color: secondaryColor} : {}
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
style={styles.menuItem}
|
style={styles.menuItem}
|
||||||
key={i.toString()}
|
key={i.toString()}
|
||||||
>
|
>
|
||||||
<Icon name={icon} {...iconStyles.menuIcon} />
|
<Icon name={icon} {...iconStyles.menuIcon} {...styleActive} />
|
||||||
<Text style={styles.menuText}>
|
<Text style={[styles.menuText, styleActive]}>
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|||||||
Reference in New Issue
Block a user