From 16b3199892f1fe6f1122399f5c169329a92005c0 Mon Sep 17 00:00:00 2001 From: Julia Friesel <julia.friesel@gmail.com> Date: Fri, 24 May 2019 11:23:12 +0200 Subject: [PATCH] Make sure drop text is always positioned correctly --- components/home.js | 12 ++++++------ styles/index.js | 4 +++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/components/home.js b/components/home.js index f6d9362a..ad4edb5b 100644 --- a/components/home.js +++ b/components/home.js @@ -32,8 +32,10 @@ const HomeElement = ({ children, onPress, buttonColor, buttonLabel }) => { onPress={ onPress } style={ styles.homeElement } > - {children[0]} - {children[1]} + <View style={styles.homeIconAndText}> + {children[0]} + {children[1]} + </View> <View style={{paddingLeft: 15}}> {children[2]} @@ -108,11 +110,9 @@ export default class Home extends Component { buttonColor={ periodColor } buttonLabel={ labels.trackPeriod } > - <View> - <DripHomeIcon name="drop" size={100} color={periodColor} /> - </View> + <DripHomeIcon name="drop" size={100} color={periodColor} /> - <IconText wrapperStyles={{top: 45, ...styles.wrapperIcon}}> + <IconText wrapperStyles={{top: '50%', ...styles.wrapperIcon}}> {this.state.bleedingPredictionRange} </IconText> diff --git a/styles/index.js b/styles/index.js index 130de97e..5fba45aa 100644 --- a/styles/index.js +++ b/styles/index.js @@ -125,7 +125,6 @@ export default StyleSheet.create({ marginBottom: defaultBottomMargin, }, homeElement: { - alignItems: 'center', marginBottom: 40, flexDirection: 'row', }, @@ -133,6 +132,9 @@ export default StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, + homeIconAndText: { + justifyContent: 'center' + }, wrapperIcon: { width: 80, position: 'absolute' -- GitLab