采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
视频中说prefetch是预加载,提前把图片下载下来存到本地磁盘,问题是下次怎么直接从磁盘读取,是直接使用相同的url然后react内部自己自动读取本地对应的图片吗?就像下面这样
<Image source={{uri: imageUri}} />
prefetch 是不是安卓兼容的不好 Image.prefetch(imageUrl) .then(data => { console.log('prefetch success', data); const source = Image.resolveAssetSource({uri: imageUrl}); console.log(`source Uri: ${source.uri}`); if (source && source.uri.startsWith('file://')) { setImageSrc(source.uri); console.log('Image is cached'); } else { console.log('Image is not cached'); } }) .catch(e => { console.log('prefetch error', e); }); 我一直打印 Image is not cached
登录后可查看更多问答,登录/注册
30+小案例+2个实战项目,快人一步提升个职业竞争力
598 2
326 16
666 15
685 12
511 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号