I have a Expo, React Native app using Native Base.
Having some issues with alignment however of the Button on iPhones.
Its displaying a list of Cards with a Button and Text, the Button is aligned to the right, when the Text is more than one line, the Button alignment fails.
The code as follows:
<List dataArray={items}
renderRow={(item) =>
<Card rounded>
<CardItem rounded style={{margin:5}}>
<Grid>
<Row>
<Text style={styles.headertext}>{item.site.name}</Text>
<Right style={{ flex: 1 }}>
{this.getEventType(item)}
</Right>
</Row>
<Row>
<Text style={styles.textIdBold}>{item.controller.name}</Text><Text> </Text><Text style={styles.textId}>{item.controller.controller_id}</Text>
</Row>
<Row>
<Text style={styles.textId}>{item.date}</Text>
</Row>
<Row>
<Text style={styles.eventMessage}>
{item.description}
</Text>
</Row>
</Grid>
</CardItem>
</Card>
}>
return of getEventType(item) is:
<Button small rounded info>
<Text>Settings</Text>
</Button>
relevant styles:
headerText:
fontSize: (Platform.OS === 'ios') ? 15 : 18,
color: '#000',
marginBottom: 0,
textAlign: 'center',
alignSelf:'flex-start'
textIdBold
fontSize: (Platform.OS === 'ios') ? 12 : 15,
color: '#000',
fontWeight: 'bold',
paddingTop: (Platform.OS === 'ios') ? 3 : 8
textId
fontSize: (Platform.OS === 'ios') ? 12 : 15,
color: '#000',
paddingTop: (Platform.OS === 'ios') ? 3 : 8
Screenshot of what is taking place:
Single line no problem for Events Button aligning to the right, multi line is a problem!
Any thoughts will be much appreciated!
After adding:
<Right style={{ flex: 1 }}>
<View style={{position:'absolute', top: 0, right: 0, zIndex:100}}>
{this.getEventType(item)}
</View>
</Right>
The result is better but not 100% solved: