反应原生-图像显示不正确

时间:2018-06-22 10:11:25

标签: react-native react-native-android react-native-image

我正在使用普通的图像标签来显示服务器图像,但是某些图像显示正确,而某些图像显示不正确。

  • 我在Android应用程序中使用react-native
  • 我已使用“本机响应”维度进行图像大小调整 相对于屏幕尺寸。
  • 通过状态传递图片网址。

<View>
   <Image 
     style={{borderWidth:1,
     width: responsiveWidth(100),
     height: responsiveHeight(50),
     resizeMode:'contain'}} 
     source = {{ uri:this.state.productimage}}/>
</View>

this is how my product image is looking like

2 个答案:

答案 0 :(得分:1)

如果您想在网格中显示服务器映像,那么这可能对您有用

<Image source={{uri:"http://pngimg.com/uploads/google/google_PNG19632.png"}} style={{height:null,width:null,flex:0.5,resizeMode:'contain'}}  />

或更改resizeMode:“ cover”

答案 1 :(得分:0)

在图像标签样式中提供高度-宽度

<Image 
source = {{ uri:"http://pngimg.com/uploads/google/google_PNG19632.png" }} 
style = {{ height:100, width:100 }}/>

相关问题