Only show the hints if minimum not selected

This commit is contained in:
Birgitta B
2019-01-13 12:05:44 +01:00
committed by birgitta410
parent 971c99ad9f
commit 88973290cb
3 changed files with 20 additions and 13 deletions
+14 -9
View File
@@ -22,15 +22,20 @@ export function AppTextLight(props) {
} }
export function ActionHint(props) { export function ActionHint(props) {
return ( if(props.isVisible) {
<View return (
style={styles.actionHintWrappingView}> <View
<AppText style={styles.actionHintWrappingView}
style={[styles.actionHint, props.style]}> isVisible={false}>
{props.children} <AppText
</AppText> style={[styles.actionHint, props.style]}>
</View> {props.children}
) </AppText>
</View>
)
} else {
return null
}
} }
export function SymptomSectionHeader(props) { export function SymptomSectionHeader(props) {
+3 -2
View File
@@ -36,6 +36,7 @@ export default class Cervix extends Component {
{ label: labels.position.categories[1], value: 1 }, { label: labels.position.categories[1], value: 1 },
{ label: labels.position.categories[2], value: 2 } { label: labels.position.categories[2], value: 2 }
] ]
const mandatoryNotCompletedYet = typeof this.state.opening != 'number' || typeof this.state.firmness != 'number'
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<ScrollView style={styles.page}> <ScrollView style={styles.page}>
@@ -82,7 +83,7 @@ export default class Cervix extends Component {
/> />
</SymptomSection> </SymptomSection>
</ScrollView> </ScrollView>
<ActionHint>{labels.actionHint}</ActionHint> <ActionHint isVisible={mandatoryNotCompletedYet}>{labels.actionHint}</ActionHint>
<ActionButtonFooter <ActionButtonFooter
symptom='cervix' symptom='cervix'
date={this.props.date} date={this.props.date}
@@ -95,7 +96,7 @@ export default class Cervix extends Component {
exclude: Boolean(this.state.exclude) exclude: Boolean(this.state.exclude)
}) })
}} }}
saveDisabled={typeof this.state.opening != 'number' || typeof this.state.firmness != 'number'} saveDisabled={mandatoryNotCompletedYet}
navigate={this.props.navigate} navigate={this.props.navigate}
/> />
</View> </View>
+3 -2
View File
@@ -34,6 +34,7 @@ export default class Mucus extends Component {
{ label: labels.texture.categories[1], value: 1 }, { label: labels.texture.categories[1], value: 1 },
{ label: labels.texture.categories[2], value: 2 } { label: labels.texture.categories[2], value: 2 }
] ]
const mandatoryNotCompletedYet = typeof this.state.feeling != 'number' || typeof this.state.texture != 'number'
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<ScrollView style={styles.page}> <ScrollView style={styles.page}>
@@ -70,7 +71,7 @@ export default class Mucus extends Component {
/> />
</SymptomSection> </SymptomSection>
</ScrollView> </ScrollView>
<ActionHint>{labels.actionHint}</ActionHint> <ActionHint isVisible={mandatoryNotCompletedYet}>{labels.actionHint}</ActionHint>
<ActionButtonFooter <ActionButtonFooter
symptom='mucus' symptom='mucus'
date={this.props.date} date={this.props.date}
@@ -85,7 +86,7 @@ export default class Mucus extends Component {
exclude: Boolean(this.state.exclude) exclude: Boolean(this.state.exclude)
}) })
}} }}
saveDisabled={typeof this.state.feeling != 'number' || typeof this.state.texture != 'number'} saveDisabled={mandatoryNotCompletedYet}
navigate={this.props.navigate} navigate={this.props.navigate}
/> />
</View> </View>