Reactjs 无法打开文件,共享后,响应本机
我已经使用react native share创建了一个共享函数,该函数获取api,以便共享一些图像,但是当我尝试通过whatsapp共享时,它会抛出一个错误:无法打开文件 我的共享功能:Reactjs 无法打开文件,共享后,响应本机,reactjs,react-native,react-native-android,react-native-flatlist,react-native-video,Reactjs,React Native,React Native Android,React Native Flatlist,React Native Video,我已经使用react native share创建了一个共享函数,该函数获取api,以便共享一些图像,但是当我尝试通过whatsapp共享时,它会抛出一个错误:无法打开文件 我的共享功能: shareImage= (item) => { console.log('hello',item) RNFetchBlob.fetch('GET', `some url`) .then(resp => { console.log('response : ', type
shareImage= (item) => {
console.log('hello',item)
RNFetchBlob.fetch('GET', `some url`)
.then(resp => {
console.log('response : ', typeof resp);
console.log('fff', JSON.parse(resp.data));
let ab = JSON.parse(resp.data);
console.log('data', ab)
let base64image = ab;
share('data:image/jpeg;base64,' + base64image);
})
.catch(err => {
err && console.log(err);
});
share = base64image => {
console.log('base64image : ', base64image);
var shareOptions = {
title:item.title,
url: base64image,
// message: 'https://somelink.com some message',
subject: 'Subject'
};
Share.open(shareOptions)
.then(res => {
console.log(res);
})
.catch(err => {
err && console.log(err);
});
}
};
共享时我的日志:
LOG response : object
LOG fff {"product": {"__v": 0, "_id": "5e301696f75182463c6874ed", "color": "Space Grey", "colors": [], "description": "6.5-inch Super Retina XDR OLED display
Water and dust resistant (4 meters for up to 30 minutes, IP68)
Triple-camera system with 12MP Ultra Wide, Wide, and Telephoto cameras; Night mode, Portrait mode, and 4K video up to 60fps
12MP TrueDepth front camera with Portrait Mode, 4K video, and Slo-Mo
Face ID for secure authentication and Apple Pay
A13 Bionic chip with third-generation Neural Engine
Fast charge with 18W adapter included
Wireless charging
Manufacturer Detail: Apple Inc, One Apple Park Way, Cupertino, CA 95014, USA", "downloads": 53, "nameImg": "61jgfLBydjL._SL1024_-1580209807807.jpg", "nameVid": "videoplayback (1)-1580209807809.mp4", "price": 99900, "sellerID": "13755902031", "sellerName": "Appario", "size": "5.8-inch", "sizes": [], "title": "Apple iPhone 11 Pro", "typeImg": "image/jpeg", "typeVid": "video/mp4", "uploadedOn": "2020-01-28T11:10:14.244Z", "urlImg": "https://atiiproductmediafiles.s3.ap-south-1.amazonaws.com/61jgfLBydjL._SL1024_-1580209807807.jpg", "urlVid": "https://atiiproductmediafiles.s3.ap-south-1.amazonaws.com/videoplayback+%281%29-1580209807809.mp4"}, "user": {"__v": 6, "_id": "5e40038bdd9ace105d01311a", "address": [], "bankDetails": [], "changes": [], "checkout": [], "like": ["5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed"], "links": [], "mobile": 8697779335, "orderPlaced": [], "orders": [], "registeredOn": "2020-02-09T13:05:15.620Z", "userDetails": ["5e40038bdd9ace105d01311b"], "wishlist": []}}
LOG data {"product": {"__v": 0, "_id": "5e301696f75182463c6874ed", "color": "Space Grey", "colors": [], "description": "6.5-inch Super Retina XDR OLED display
Water and dust resistant (4 meters for up to 30 minutes, IP68)
Triple-camera system with 12MP Ultra Wide, Wide, and Telephoto cameras; Night mode, Portrait mode, and 4K video up to 60fps
12MP TrueDepth front camera with Portrait Mode, 4K video, and Slo-Mo
Face ID for secure authentication and Apple Pay
A13 Bionic chip with third-generation Neural Engine
Fast charge with 18W adapter included
Wireless charging
Manufacturer Detail: Apple Inc, One Apple Park Way, Cupertino, CA 95014, USA", "downloads": 53, "nameImg": "61jgfLBydjL._SL1024_-1580209807807.jpg", "nameVid": "videoplayback (1)-1580209807809.mp4", "price": 99900, "sellerID": "13755902031", "sellerName": "Appario", "size": "5.8-inch", "sizes": [], "title": "Apple iPhone 11 Pro", "typeImg": "image/jpeg", "typeVid": "video/mp4", "uploadedOn": "2020-01-28T11:10:14.244Z", "urlImg": "https://atiiproductmediafiles.s3.ap-south-1.amazonaws.com/61jgfLBydjL._SL1024_-1580209807807.jpg", "urlVid": "https://atiiproductmediafiles.s3.ap-south-1.amazonaws.com/videoplayback+%281%29-1580209807809.mp4"}, "user": {"__v": 6, "_id": "5e40038bdd9ace105d01311a", "address": [], "bankDetails": [], "changes": [], "checkout": [], "like": ["5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed", "5e301696f75182463c6874ed"], "links": [], "mobile": 8697779335, "orderPlaced": [], "orders": [], "registeredOn": "2020-02-09T13:05:15.620Z", "userDetails": ["5e40038bdd9ace105d01311b"], "wishlist": []}}
LOG base64image : data:image/jpeg;base64,[object Object]
LOG {"app": "com.google.android.gm/com.google.android.gm.ComposeActivityGmailExternal", "message": "com.google.android.gm/com.google.android.gm.ComposeActivityGmailExternal"}
LOG hello {"_dispatchInstances": {"_debugHookTypes": nul
请告诉我哪里出了问题,已经两天了,我仍然卡在那里,请帮助。您添加了权限吗?我添加了读取外部存储和写入外部存储,我还需要什么吗@Ragnar您是否有错误日志,其中提到
无法打开文件
?