【发布时间】:2019-03-09 17:08:11
【问题描述】:
我正在尝试从 url 下载图像,然后通过 whats 应用程序和其他社交媒体将其作为图像格式分享,我尝试了一些方法但我做不到,我的代码如下:
let filePath = null;
const configOptions = {
fileCache: true,
};
RNFetchBlob.config(configOptions)
.fetch('GET', url)
.then(async resp => {
filePath = resp.path();
let options = {
url: filePath
};
await Share.open(options);
await RNFS.unlink(filePath);
});
我也试过了
RNFetchBlob.fetch("GET",url,{
Authorization : 'Bearer access-token...',
})
.then(resp => {
console.log(resp)
let shareImageBase64 = {
title: "React Native",
message: "Hola mundo",
url: `data:image/png;base64,` + resp.base64(),
};
Share.open(shareImageBase64);
})
它确实打开了共享选项,但没有图像,只能共享消息。
【问题讨论】:
-
使用 react-native-share 共享单个/多个图像或 pdf 文件,请在此处回答我提供更详细的信息,结帐 - stackoverflow.com/questions/67016851/…
标签: react-native share