加载本地图片:
加载本地图片,推荐使用require方式
<Image source={ require('../assets/1.png') } />
默认Image会去根据设备的分辨率自动匹配图片的大小,所以把1@2x.png 和1@3x.png同时放在assets目录下,而显示的时候不需要跟上@后面的文本,不然显示会报错。
加载网络图片
<Image source={{uri:"http://www.hangge.com/blog/images/logo.png";}} />
场景,在某些图片上传功能中,扫描上来的图片返回的imgUrl是类似这种的:
file://D://xxx/xxx/xxx/xxx/22.png
这个时候需要使用加载网络图片的方式进行加载,否则会报错。