reactnative图片排列

图片的resizeMethod='resize'可以自动压缩图片,一般resizeMode用contain,
图片的高度需要动态计算:
<Image key={index} source={{uri: number.content}} resizeMethod='auto' resizeMode='contain' style={{flex:1,margin:0,padding:0,borderWidth:0}} onLoadStart={()=>{
Image.getSize(number.content, (width, height) => {
let ratio=width/(screenW*pixdp);//计算图片宽度折算的比率
console.log(ratio);
this.setState({totalHeight:this.state.totalHeight+height/(ratio*pixdp)});
console.log('image'+index+' height is '+ height);
});
}} />

posted on 2017-04-20 14:05  Aoooo  阅读(141)  评论(0编辑  收藏  举报

导航