Make sure drop text is always positioned correctly

This commit is contained in:
Julia Friesel
2019-05-24 11:23:12 +02:00
parent d13a776970
commit 16b3199892
2 changed files with 9 additions and 7 deletions
+6 -6
View File
@@ -32,8 +32,10 @@ const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => {
onPress={ onPress } onPress={ onPress }
style={ styles.homeElement } style={ styles.homeElement }
> >
{children[0]} <View style={styles.homeIconAndText}>
{children[1]} {children[0]}
{children[1]}
</View>
<View style={{paddingLeft: 15}}> <View style={{paddingLeft: 15}}>
{children[2]} {children[2]}
@@ -108,11 +110,9 @@ export default class Home extends Component {
buttonColor={ periodColor } buttonColor={ periodColor }
buttonLabel={ labels.trackPeriod } buttonLabel={ labels.trackPeriod }
> >
<View> <DripHomeIcon name="drop" size={100} color={periodColor} />
<DripHomeIcon name="drop" size={100} color={periodColor} />
</View>
<IconText wrapperStyles={{top: 45, ...styles.wrapperIcon}}> <IconText wrapperStyles={{top: '50%', ...styles.wrapperIcon}}>
{this.state.bleedingPredictionRange} {this.state.bleedingPredictionRange}
</IconText> </IconText>
+3 -1
View File
@@ -125,7 +125,6 @@ export default StyleSheet.create({
marginBottom: defaultBottomMargin, marginBottom: defaultBottomMargin,
}, },
homeElement: { homeElement: {
alignItems: 'center',
marginBottom: 40, marginBottom: 40,
flexDirection: 'row', flexDirection: 'row',
}, },
@@ -133,6 +132,9 @@ export default StyleSheet.create({
alignItems: 'center', alignItems: 'center',
justifyContent: 'center', justifyContent: 'center',
}, },
homeIconAndText: {
justifyContent: 'center'
},
wrapperIcon: { wrapperIcon: {
width: 80, width: 80,
position: 'absolute' position: 'absolute'