gpt4 book ai didi

react-native - 显示存储在手机上的图像

转载 作者:行者123 更新时间:2023-12-04 04:15:11 25 4
gpt4 key购买 nike

我已经成功地在我的应用程序中拍摄了一张照片并将其存储在手机上,但我如何显示它?

我尝试了这种静态方法,但它不起作用(是的,图像在那里:))

 <Image width={40} height={40} source={{uri: '/storage/emulated/0/DCIM/IMG_20161201_125218.jpg'}} />

最佳答案

即使我遇到了这个问题并得到了解决。您必须在文件路径前面加上 file://(注意双/)。

<Image source={{uri:'file:///storage/emulated/0/DCIM/IMG_20161201_125218.jpg'}}
style={myImageStyle}/>

这是一个 reference !

我希望这有帮助 :)

关于react-native - 显示存储在手机上的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40910559/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com