[英]React-Native loading android contact images
I have an image URI that looks like this: content://com.android.contacts/contacts/3992/photo.jpg
我有一个看起来像这样的图像 URI:
content://com.android.contacts/contacts/3992/photo.jpg
I then use that URI as such然后我使用那个URI
<Image source={{uri: contact.thumbnailPath}} style={styles.thumbnail} />
However, I can't see the picture!但是,我看不到图片! Any idea what the issue might be?
知道问题可能是什么吗?
According to: https://facebook.github.io/react-native/docs/image.html#adding-static-resources-to-your-android-app 根据: https : //facebook.github.io/react-native/docs/image.html#adding-static-resources-to-your-android-app
I think your code should be like this 我认为您的代码应该像这样
<Image
style={styles.icon}
source={require('image!myIcon')}
/>
instead of: 代替:
<Image source={{uri: contact.thumbnailPath}} style={styles.thumbnail} />
where myIcon
would be in your case photo
您的案例
photo
中myIcon
所在的myIcon
Please read the documentation above and also this one: Use <Image> with a local file 请阅读上面的文档以及该文档: 将<Image>与本地文件一起使用
Hope it help 希望对你有帮助
you just need to ask width and height to make it worked.您只需要询问宽度和高度即可使其正常工作。 <Image source={{uri: contact.thumbnailPath}}, width:48,height:48 />
<图片来源={{uri:contact.thumbnailPath}}, width:48,height:48 />
Instead of passing a source prop use a simple HTML property src<\/strong>不要传递源道具,而是使用简单的 HTML 属性src<\/strong>
src={contact.thumbnailPath}
I have an image URI that looks like this: content://com.android.contacts/contacts/3992/photo.jpg
我有一个看起来像这样的图像URI:
content://com.android.contacts/contacts/3992/photo.jpg
I then use that URI as such然后我像这样使用该URI
<Image source={{uri: contact.thumbnailPath}} style={styles.thumbnail} />
However, I can't see the picture!但是,我看不到图片! Any idea what the issue might be?
知道可能是什么问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.