I'm trying to get a paragraph to align properly in React Native but so far I have been unable to reach the desired look for it.
This component is a simple box with three main <Text/> components. Each one of these components has a completely different style and they receive a string variable passed down as props.
The final look I'm going for is:
I've tried building the component as follows:
<View style={layoutStyles.mainContainer}>
<View style={layoutStyles.textContainer}>
<Text style={textStyles.highlightedText}>{highlightedText}</Text>
<View style={layoutStyles.contentContainer}>
<Text style={textStyles.content}>{content}</Text>
</View>
</View>
<Text style={textStyles.linkText}>{link}</Text>
<View style={layoutStyles.exitContainer}>
<Icon
name="CROSS"
style={textStyles.exitText}
lineHeight={30}
size={25}
/>
</View>
</View>
and styled it as so:
export const layoutStyles = StyleSheet.create({
mainContainer: {
marginVertical: 40,
alignSelf: 'center',
width: 355,
height: 74,
borderRadius: 4,
backgroundColor: 'white',
borderWidth: 1,
borderColor: 'blue',
},
textContainer: {
flexDirection: 'row',
alignItems: 'flex-start',
width: 180,
backgroundColor: 'red',
},
contentContainer: {
backgroundColor: 'green',
alignSelf: 'flex-start',
},
exitContainer: {
alignSelf: 'center',
marginLeft: 20,
},
});
export const textStyles = StyleSheet.create({
highlightedText: {
color: 'blue',
fontSize: 12,
lineHeight: 18,
fontWeight: '600',
backgroundColor: 'blue',
},
content: {
color: 'blue',
fontSize: 12,
lineHeight: 18,
},
linkText: {
color: 'grey',
textDecorationLine: 'underline',
fontSize: 12,
lineHeight: 18,
},
exitText: {
color: 'black',
},
});
But as it is made obvious by the colors of the backgrounds, I've no idea how to align the text so the "content" drops down below the "highlighted text"
I'm clueless as to how to solve it. Any help is deeply appreciated.


