2016-12-01 19 views
0

我已经成功地将我的应用程序内的照片存储在手机中,但是如何显示它?显示存储在手机上的图像

我试过这种静态的方法,但它不工作(是图像有:))

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

您使用的库来拍照?你应该能够得到从那里返回的数据。否则,[Camera Roll](https://facebook.github.io/react-native/docs/cameraroll.html)API怎么办? –

+0

刚刚使用的库将路径返回到文件。 – D3athSpank

+0

它是什么库? –

回答

2

即使我面临过这样的问题,并得到了其解决。你必须在文件路径前添加file://(介意double /)。

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

这里有一个reference

我希望这有助于:)

+0

它对我不起作用 file:/// storage/emulated/0/appiwell /image/qkpOyUaRla.jpg –

0
<Image source = {{uri: "file:///storage/emulated/0/appiwell/image/qkpOyUaRla.jpg", 
        width: responsiveWidth(100), 
        height: responsiveHeight(100)}}/> 

通知,应设置宽度,高度内{URI,宽度,高度}。宽度,风格的高度可能不起作用。

responsiveWidth,responsiveHeight这里 https://www.npmjs.com/package/react-native-responsive-dimensions

相关问题