I have the following code:
let imgSrc =resolveAssetSource("data:image/png;base64,"+img);
console.log(imgSrc);
let img = <Image source={{uri:"data:image/png;base64,"+img}} style={{width:imgSrc.width/2, height:imgSrc.height/2}} />;
但是代码会崩溃,因为imgSrc为空。我如何获取base64编码图像的宽度和高度,以便在<Image style={} />
元素中使用?
{ width: '50%', height: '50%'}
我不确定这是否有效。 - bennygenel