Merge branch '298-add-back-button-to-settings-children' into 'master'
Adds back button to settings header Closes #298 See merge request bloodyhealth/drip!171
This commit is contained in:
+9
-8
@@ -94,9 +94,7 @@ export default class App extends Component {
|
|||||||
|
|
||||||
isDefaultView() {
|
isDefaultView() {
|
||||||
const { currentPage } = this.state
|
const { currentPage } = this.state
|
||||||
return currentPage !== CYCLE_DAY_PAGE &&
|
return this.isMenuItem(currentPage) || currentPage === SETTINGS_MENU_PAGE
|
||||||
!this.isSymptomView() &&
|
|
||||||
!this.isInfoSymptomView()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@@ -114,16 +112,19 @@ export default class App extends Component {
|
|||||||
}
|
}
|
||||||
const page = pages[currentPage]
|
const page = pages[currentPage]
|
||||||
const title = headerTitlesLowerCase[currentPage]
|
const title = headerTitlesLowerCase[currentPage]
|
||||||
const isSymptomView = this.isSymptomView()
|
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
{this.isDefaultView() &&
|
{this.isDefaultView() &&
|
||||||
<Header title={title} />
|
<Header title={title} />
|
||||||
}
|
}
|
||||||
{this.isInfoSymptomView() &&
|
{(this.isInfoSymptomView() || this.isSettingsView()) &&
|
||||||
<Header title={title} goBack={this.handleBackButtonPress} />
|
<Header
|
||||||
|
title={title}
|
||||||
|
showBackButton={true}
|
||||||
|
goBack={this.handleBackButtonPress}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
{isSymptomView &&
|
{this.isSymptomView() &&
|
||||||
<Header
|
<Header
|
||||||
title={title}
|
title={title}
|
||||||
isSymptomView={true}
|
isSymptomView={true}
|
||||||
@@ -140,7 +141,7 @@ export default class App extends Component {
|
|||||||
...currentProps
|
...currentProps
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{!isSymptomView &&
|
{!this.isSymptomView() &&
|
||||||
<Menu navigate={this.navigate} currentPage={currentPage} />
|
<Menu navigate={this.navigate} currentPage={currentPage} />
|
||||||
}
|
}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import styles, { iconStyles } from '../../styles'
|
|||||||
import NavigationArrow from './navigation-arrow'
|
import NavigationArrow from './navigation-arrow'
|
||||||
import Icon from 'react-native-vector-icons/Entypo'
|
import Icon from 'react-native-vector-icons/Entypo'
|
||||||
|
|
||||||
export default function InfoSymptomHeader(props) {
|
export default function BackButtonHeader(props) {
|
||||||
return (
|
return (
|
||||||
<View style={[styles.header, styles.headerCycleDay, styles.headerSymptom]}>
|
<View style={[styles.header, styles.headerCycleDay, styles.headerSymptom]}>
|
||||||
<View
|
<View
|
||||||
@@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
import { Dimensions } from 'react-native'
|
import { Dimensions } from 'react-native'
|
||||||
import CycleDayHeader from './cycle-day'
|
import CycleDayHeader from './cycle-day'
|
||||||
import DefaultHeader from './default'
|
import DefaultHeader from './default'
|
||||||
import InfoSymptomHeader from './info-symptom'
|
import BackButtonHeader from './back-button'
|
||||||
import SymptomViewHeader from './symptom-view'
|
import SymptomViewHeader from './symptom-view'
|
||||||
|
|
||||||
export default function Header(p) {
|
export default function Header(p) {
|
||||||
@@ -15,8 +15,8 @@ export default function Header(p) {
|
|||||||
else if (props.isSymptomView) {
|
else if (props.isSymptomView) {
|
||||||
return (<SymptomViewHeader {...props} />)
|
return (<SymptomViewHeader {...props} />)
|
||||||
}
|
}
|
||||||
else if (props.title === 'info') {
|
else if (props.showBackButton) {
|
||||||
return (<InfoSymptomHeader {...props} />)
|
return (<BackButtonHeader {...props} />)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (<DefaultHeader {...props} />)
|
return (<DefaultHeader {...props} />)
|
||||||
|
|||||||
Reference in New Issue
Block a user