Skip to content
Snippets Groups Projects
Commit 1d0b2497 authored by Julia Friesel's avatar Julia Friesel
Browse files

Make select box text a child not a prop

parent 8b37fa3c
No related branches found
No related tags found
No related merge requests found
...@@ -17,7 +17,7 @@ export default class SelectBox extends Component { ...@@ -17,7 +17,7 @@ export default class SelectBox extends Component {
return ( return (
<TouchableOpacity onPress={this.props.onPress}> <TouchableOpacity onPress={this.props.onPress}>
<View style={style}> <View style={style}>
<AppText style={textStyle}>{this.props.label}</AppText> <AppText style={textStyle}>{this.props.children}</AppText>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
) )
......
...@@ -63,9 +63,10 @@ export default class Sex extends Component { ...@@ -63,9 +63,10 @@ export default class Sex extends Component {
<SelectBox <SelectBox
value={this.state[stateKey]} value={this.state[stateKey]}
onPress={() => this.toggleState(stateKey)} onPress={() => this.toggleState(stateKey)}
label={label}
key={stateKey} key={stateKey}
/> >
{label}
</SelectBox>
) )
}) })
} }
...@@ -85,12 +86,14 @@ export default class Sex extends Component { ...@@ -85,12 +86,14 @@ export default class Sex extends Component {
{this.makeSelectBoxes(contraceptiveBoxes)} {this.makeSelectBoxes(contraceptiveBoxes)}
<SelectBox <SelectBox
value={this.state.other} value={this.state.other}
label={contraceptiveLabels.other}
onPress={() => { onPress={() => {
this.toggleState('other') this.toggleState('other')
this.setState({ focusTextArea: true }) this.setState({ focusTextArea: true })
}} }}
/> >
{contraceptiveLabels.other}
</SelectBox>
{this.state.other && {this.state.other &&
<TextInput <TextInput
autoFocus={this.state.focusTextArea} autoFocus={this.state.focusTextArea}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment