Add app text component and remove radio button dep

This commit is contained in:
Julia Friesel
2018-09-01 18:11:55 +02:00
parent ca8764aa4b
commit 8b37fa3ca4
17 changed files with 1626 additions and 1643 deletions
+3 -3
View File
@@ -2,7 +2,6 @@ import React, { Component } from 'react'
import {
ScrollView,
View,
Text,
TouchableOpacity,
Dimensions
} from 'react-native'
@@ -22,6 +21,7 @@ import {
cervixPosition as positionLabels,
intensity as intensityLabels
} from './labels/labels'
import { AppText } from '../app-text'
export default class CycleDayOverView extends Component {
constructor(props) {
@@ -198,10 +198,10 @@ class SymptomBox extends Component {
name='thermometer'
{...iconStyle}
/>
<Text style={[textActive, disabledStyle]}>{this.props.title}</Text>
<AppText style={[textActive, disabledStyle]}>{this.props.title}</AppText>
</View>
<View style={[styles.symptomDataBox, disabledStyle]}>
<Text style={styles.symptomDataText}>{this.props.data}</Text>
<AppText style={styles.symptomDataText}>{this.props.data}</AppText>
</View>
</TouchableOpacity>
)
+3 -4
View File
@@ -1,10 +1,10 @@
import React, { Component } from 'react'
import {
View,
Text,
TouchableOpacity,
} from 'react-native'
import styles from '../../styles'
import { AppText } from '../app-text'
export default class RadioButton extends Component {
render() {
@@ -13,7 +13,6 @@ export default class RadioButton extends Component {
{
this.props.buttons.map(({ label, value }) => {
const isActive = value === this.props.active
const circleStyle = [styles.radioButton]
return (
<TouchableOpacity
onPress={() => this.props.onSelect(value)}
@@ -21,11 +20,11 @@ export default class RadioButton extends Component {
activeOpacity={1}
>
<View style={styles.radioButtonTextGroup}>
<View style={circleStyle}>
<View style={styles.radioButton}>
{isActive ?
<View style={styles.radioButtonActiveDot}/> : null}
</View>
<Text>{label}</Text>
<AppText>{label}</AppText>
</View>
</TouchableOpacity>
)
+2 -2
View File
@@ -1,10 +1,10 @@
import React, { Component } from 'react'
import {
View,
Text,
TouchableOpacity,
} from 'react-native'
import styles from '../../styles'
import { AppText } from '../app-text'
export default class SelectBox extends Component {
render () {
@@ -17,7 +17,7 @@ export default class SelectBox extends Component {
return (
<TouchableOpacity onPress={this.props.onPress}>
<View style={style}>
<Text style={textStyle}>{this.props.label}</Text>
<AppText style={textStyle}>{this.props.label}</AppText>
</View>
</TouchableOpacity>
)
+14 -16
View File
@@ -1,15 +1,15 @@
import React, { Component } from 'react'
import {
View,
Text,
Switch,
ScrollView
} from 'react-native'
import RadioForm from 'react-native-simple-radio-button'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import { bleeding as labels } from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
import RadioButtonGroup from '../radio-button-group'
import { SymptomSectionHeader, AppText } from '../../app-text'
export default class Bleeding extends Component {
constructor(props) {
@@ -37,20 +37,18 @@ export default class Bleeding extends Component {
<View style={{ flex: 1 }}>
<ScrollView style={styles.page}>
<View>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={bleedingRadioProps}
initial={this.state.currentValue}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ currentValue: itemValue })
}}
/>
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Exclude</Text>
<SymptomSectionHeader>Heaviness</SymptomSectionHeader>
<AppText>How heavy is the bleeding?</AppText>
<RadioButtonGroup
buttons={bleedingRadioProps}
active={this.state.currentValue}
onSelect={val => this.setState({ currentValue: val })}
/>
<SymptomSectionHeader>Exclude</SymptomSectionHeader>
<View flexDirection={'row'}>
<View flex={1}>
<AppText>You can exclude this value if it's not menstrual bleeding</AppText>
</View>
<Switch
onValueChange={(val) => {
this.setState({ exclude: val })
+21 -42
View File
@@ -1,11 +1,9 @@
import React, { Component } from 'react'
import {
View,
Text,
Switch,
ScrollView
} from 'react-native'
import RadioForm from 'react-native-simple-radio-button'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import {
@@ -14,6 +12,8 @@ import {
cervixPosition as positionLabels
} from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
import RadioButtonGroup from '../radio-button-group'
import { SymptomSectionHeader } from '../../app-text'
export default class Cervix extends Component {
constructor(props) {
@@ -53,47 +53,26 @@ export default class Cervix extends Component {
<View style={{ flex: 1 }}>
<ScrollView style={styles.page}>
<View>
<Text style={styles.symptomViewHeading}>Opening</Text>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={cervixOpeningRadioProps}
initial={this.state.opening}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ opening: itemValue })
}}
/>
</View>
<Text style={styles.symptomViewHeading}>Firmness</Text>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={cervixFirmnessRadioProps}
initial={this.state.firmness}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ firmness: itemValue })
}}
/>
</View>
<Text style={styles.symptomViewHeading}>Position</Text>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={cervixPositionRadioProps}
initial={this.state.position}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ position: itemValue })
}}
/>
</View>
<SymptomSectionHeader>Opening</SymptomSectionHeader>
<RadioButtonGroup
buttons={cervixOpeningRadioProps}
active={this.state.opening}
onSelect={val => this.setState({ opening: val })}
/>
<SymptomSectionHeader>Firmness</SymptomSectionHeader>
<RadioButtonGroup
buttons={cervixFirmnessRadioProps}
active={this.state.firmness}
onSelect={val => this.setState({ firmness: val })}
/>
<SymptomSectionHeader>Position</SymptomSectionHeader>
<RadioButtonGroup
buttons={cervixPositionRadioProps}
active={this.state.position}
onSelect={val => this.setState({ position: val })}
/>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Exclude</Text>
<SymptomSectionHeader>Exclude</SymptomSectionHeader>
<Switch
onValueChange={(val) => {
this.setState({ exclude: val })
+6 -13
View File
@@ -3,11 +3,11 @@ import {
View,
ScrollView
} from 'react-native'
import RadioForm from 'react-native-simple-radio-button'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import { intensity as labels } from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
import RadioButtonGroup from '../radio-button-group'
export default class Desire extends Component {
constructor(props) {
@@ -31,18 +31,11 @@ export default class Desire extends Component {
<View style={{ flex: 1 }}>
<ScrollView style={styles.page}>
<View>
<View style={styles.radioButtonRow}>
<RadioForm
radio_props={desireRadioProps}
initial={this.state.currentValue}
formHorizontal={true}
labelHorizontal={false}
labelStyle={styles.radioButton}
onPress={(itemValue) => {
this.setState({ currentValue: itemValue })
}}
/>
</View>
<RadioButtonGroup
buttons={desireRadioProps}
acitve={this.state.currentValue}
onSelect={val => this.setState({ currentValue: val })}
/>
</View>
</ScrollView>
<ActionButtonFooter
+14 -18
View File
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
import {
View,
Text,
Switch,
ScrollView
} from 'react-native'
@@ -14,6 +13,7 @@ import {
import computeSensiplanValue from '../../../lib/sensiplan-mucus'
import ActionButtonFooter from './action-button-footer'
import RadioButtonGroup from '../radio-button-group'
import { SymptomSectionHeader } from '../../app-text'
export default class Mucus extends Component {
@@ -51,24 +51,20 @@ export default class Mucus extends Component {
<View style={{ flex: 1 }}>
<ScrollView style={styles.page}>
<View>
<Text style={styles.symptomViewHeading}>Feeling</Text>
<View style={styles.radioButtonRow}>
<RadioButtonGroup
buttons={mucusFeeling}
onSelect={val => this.setState({feeling: val})}
active={this.state.feeling}
/>
</View>
<Text style={styles.symptomViewHeading}>Texture</Text>
<View style={styles.radioButtonRow}>
<RadioButtonGroup
buttons={mucusTexture}
onSelect={val => this.setState({texture: val})}
active={this.state.texture}
/>
</View>
<SymptomSectionHeader>Feeling</SymptomSectionHeader>
<RadioButtonGroup
buttons={mucusFeeling}
onSelect={val => this.setState({ feeling: val })}
active={this.state.feeling}
/>
<SymptomSectionHeader>Texture</SymptomSectionHeader>
<RadioButtonGroup
buttons={mucusTexture}
onSelect={val => this.setState({ texture: val })}
active={this.state.texture}
/>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Exclude</Text>
<SymptomSectionHeader>Exclude</SymptomSectionHeader>
<Switch
onValueChange={(val) => {
this.setState({ exclude: val })
+13 -17
View File
@@ -1,6 +1,5 @@
import React, { Component } from 'react'
import {
Text,
TextInput,
View,
ScrollView
@@ -13,6 +12,7 @@ import {
} from '../labels/labels'
import ActionButtonFooter from './action-button-footer'
import SelectBox from '../select-box'
import { SymptomSectionHeader } from '../../app-text'
const sexBoxes = [{
label: activityLabels.solo,
@@ -79,22 +79,18 @@ export default class Sex extends Component {
return (
<View style={{ flex: 1 }}>
<ScrollView style={styles.page}>
<Text style={styles.symptomViewHeading}>Activity</Text>
<View style={styles.selectBoxSection}>
{this.makeSelectBoxes(sexBoxes)}
</View>
<Text style={styles.symptomViewHeading}>Contraceptives</Text>
<View style={styles.selectBoxSection}>
{this.makeSelectBoxes(contraceptiveBoxes)}
<SelectBox
value={this.state.other}
label={contraceptiveLabels.other}
onPress={() => {
this.toggleState('other')
this.setState({ focusTextArea: true })
}}
/>
</View>
<SymptomSectionHeader>Activity</SymptomSectionHeader>
{this.makeSelectBoxes(sexBoxes)}
<SymptomSectionHeader>Contraceptives</SymptomSectionHeader>
{this.makeSelectBoxes(contraceptiveBoxes)}
<SelectBox
value={this.state.other}
label={contraceptiveLabels.other}
onPress={() => {
this.toggleState('other')
this.setState({ focusTextArea: true })
}}
/>
{this.state.other &&
<TextInput
autoFocus={this.state.focusTextArea}
+5 -7
View File
@@ -1,7 +1,6 @@
import React, { Component } from 'react'
import {
View,
Text,
TextInput,
Switch,
Keyboard,
@@ -18,6 +17,7 @@ import { scaleObservable } from '../../../local-storage'
import { shared } from '../../labels'
import ActionButtonFooter from './action-button-footer'
import config from '../../../config'
import { SymptomSectionHeader } from '../../app-text'
const minutes = ChronoUnit.MINUTES
@@ -99,7 +99,7 @@ export default class Temp extends Component {
<ScrollView style={styles.page}>
<View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Temperature (°C)</Text>
<SymptomSectionHeader>Temperature (°C)</SymptomSectionHeader>
<TempInput
value={this.state.temperature}
setState={(val) => this.setState(val)}
@@ -107,7 +107,7 @@ export default class Temp extends Component {
/>
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Time</Text>
<SymptomSectionHeader>Time</SymptomSectionHeader>
<TextInput
style={styles.temperatureTextInput}
onFocus={() => {
@@ -128,9 +128,7 @@ export default class Temp extends Component {
}}
onCancel={() => this.setState({ isTimePickerVisible: false })}
/>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Note</Text>
</View>
<SymptomSectionHeader>Note</SymptomSectionHeader>
<View>
<TextInput
style={styles.temperatureTextInput}
@@ -144,7 +142,7 @@ export default class Temp extends Component {
/>
</View>
<View style={styles.symptomViewRowInline}>
<Text style={styles.symptomViewHeading}>Exclude</Text>
<SymptomSectionHeader>Exlude</SymptomSectionHeader>
<Switch
onValueChange={(val) => {
this.setState({ exclude: val })