diff --git a/components/cycle-day/radio-button-group.js b/components/cycle-day/radio-button-group.js
new file mode 100644
index 0000000..4ef8358
--- /dev/null
+++ b/components/cycle-day/radio-button-group.js
@@ -0,0 +1,36 @@
+import React, { Component } from 'react'
+import {
+ View,
+ Text,
+ TouchableOpacity,
+} from 'react-native'
+import styles from '../../styles'
+
+export default class RadioButton extends Component {
+ render() {
+ return (
+
+ {
+ this.props.buttons.map(({ label, value }) => {
+ const circleStyle = [styles.radioButton]
+ if (value === this.props.active) {
+ circleStyle.push(styles.radioButtonActive)
+ }
+ return (
+ this.props.onSelect(value)}
+ key={value}
+ activeOpacity={1}
+ >
+
+
+ {label}
+
+
+ )
+ })
+ }
+
+ )
+ }
+}
\ No newline at end of file
diff --git a/components/cycle-day/symptoms/mucus.js b/components/cycle-day/symptoms/mucus.js
index 1e9b664..b7ca8d1 100644
--- a/components/cycle-day/symptoms/mucus.js
+++ b/components/cycle-day/symptoms/mucus.js
@@ -5,7 +5,6 @@ import {
Switch,
ScrollView
} from 'react-native'
-import RadioForm from 'react-native-simple-radio-button'
import styles from '../../../styles'
import { saveSymptom } from '../../../db'
import {
@@ -14,7 +13,7 @@ import {
} from '../labels/labels'
import computeSensiplanValue from '../../../lib/sensiplan-mucus'
import ActionButtonFooter from './action-button-footer'
-import SelectBox from '../select-box'
+import RadioButtonGroup from '../radio-button-group'
export default class Mucus extends Component {
@@ -37,13 +36,13 @@ export default class Mucus extends Component {
}
render() {
- const mucusFeelingBoxes = [
- { label: feelingLabels[0], value: 0 },
+ const mucusFeeling = [
+ { label: feelingLabels[0], stateKey: ''},
{ label: feelingLabels[1], value: 1 },
{ label: feelingLabels[2], value: 2 },
{ label: feelingLabels[3], value: 3 }
]
- const mucusTextureRadioProps = [
+ const mucusTexture = [
{ label: textureLabels[0], value: 0 },
{ label: textureLabels[1], value: 1 },
{ label: textureLabels[2], value: 2 }
@@ -54,11 +53,19 @@ export default class Mucus extends Component {
Feeling
- {makeSelectBoxes(mucusFeelingBoxes, 'feeling')}
+ this.setState({feeling: val})}
+ active={this.state.feeling}
+ />
Texture
- {makeSelectBoxes(mucusTextureRadioProps, 'texture')}
+ this.setState({texture: val})}
+ active={this.state.texture}
+ />
Exclude
@@ -89,15 +96,3 @@ export default class Mucus extends Component {
)
}
}
-
-function makeSelectBoxes(boxes, category) {
- return boxes.map(({ label, value }) => {
- return (
- this.setState({ [category]: value })}
- key={value}
- />
- )
- })
-}
\ No newline at end of file
diff --git a/styles/index.js b/styles/index.js
index af29deb..7cc0c14 100644
--- a/styles/index.js
+++ b/styles/index.js
@@ -30,12 +30,6 @@ export default StyleSheet.create({
width: 50,
height: 50
},
- radioButton: {
- fontSize: 18,
- margin: 8,
- textAlign: 'center',
- textAlignVertical: 'center'
- },
symptomBoxesView: {
flexDirection: 'row',
flexWrap: 'wrap',
@@ -151,8 +145,6 @@ export default StyleSheet.create({
},
radioButtonRow: {
marginTop: 15,
- marginLeft: 'auto',
- marginRight: 'auto'
},
statsIntro: {
fontSize: 18,
@@ -216,6 +208,28 @@ export default StyleSheet.create({
flexWrap: 'wrap',
marginVertical: 10,
},
+ radioButton: {
+ width: 30,
+ height: 30,
+ borderRadius: 100,
+ borderStyle: 'solid',
+ borderWidth: 2,
+ borderColor: secondaryColor,
+ marginBottom: 5
+ },
+ radioButtonActive: {
+ backgroundColor: secondaryColor,
+ color: fontOnPrimaryColor
+ },
+ radioButtonGroup: {
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ marginVertical: 10,
+ },
+ radioButtonTextGroup: {
+ alignItems: 'center',
+ marginHorizontal: 10
+ },
page: {
padding: 10
}