I have created a simple view with an image on the right and some text on the left. Here is how it appears:
return (
<View style={styles.companyContainerStyle}>
<View>
<Text>{this.props.companyNameAr}</Text>
<Text>{this.props.descriptionAr}</Text>
</View>
<View style={styles.imageContainerStyle}>
<Image
style={styles.imageStyle}
source={{ uri: this.props.logo }}
resizeMode='contain'
resizeMethod='auto'
/>
</View>
</View>
);
Here are the styles applied in order to align the text and image next to each other:
const styles = {
companyContainerStyle: {
flex: 1,
flexDirection: 'row',
padding: 10
},
imageContainerStyle: {
borderRadius: 5,
borderWidth: 2,
borderColor: '#2279b4',
padding: 1,
},
imageStyle: {
flex: 1,
height: 100,
width: 100,
}
}
However, when viewed on the emulator, it looks like this: https://i.sstatic.net/Rs19Y.png
The issue seems to be that the length of the text is causing the image to be pushed off the screen to the very right. I expected the number of lines to adjust automatically to fit everything on the screen, but that is not happening. How can I ensure that everything appears neat even if the length of the text varies (as it is being fetched from a database)?