我试图使文本显示在图像的右侧,但是由于某些原因,flexDirection无法按我使用的方式工作。
我已经移动了flexDirection属性。除了View以外,还尝试过其他东西。
<View
style={{ flexDirection: 'row' }}
style={{
flex: 1,
backgroundColor: this.props.index % 2 == 0 ? '#420225' : '#69053e'
}}
>
<Image
source={{ uri: this.props.item.imageUrl }}
style={{ width: 100, height: 100, margin: 5 }}
/>
<Text style={{ color: 'white' }}>{this.props.item.textContent}
</Text>
</View>
我正在尝试使文本显示在图像的右侧。
答案 0 :(得分:1)
我稍微更改了您的代码。您的视图不应具有2种样式。
<View
style={{
flex: 1,
flexDirection: 'row' ,
}}>
<Image
source={{ uri: "https://url.com" }}
style={{ width: 100, height: 100, margin: 5 }}
/>
<Text>something
</Text>
</View>