Не удается открыть файл, после обмена, React-native - PullRequest
0 голосов
/ 10 февраля 2020

Я создал функцию общего доступа с использованиемact-native-share, которая извлекает api, чтобы поделиться некоторыми изображениями, однако, когда я пытаюсь поделиться через whatsapp, выдает ошибку: не удается открыть файл.

Моя функция обмена:

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

Пожалуйста, скажите мне, где идет не так, пожалуйста, это было два дня, и я все еще застрял, пожалуйста, помогите.

...