通过React Native将图片分享到Instagram

时间:2019-09-21 19:31:09

标签: react-native

我是RN的新手,我想知道你们中的任何人是否曾经构建过一个将图像发送到Instagram的应用程序。

我正在尝试使用https://github.com/lucasferreira/react-native-send-intent来执行此操作,但出现此错误:

exposed beyond app through clipdata.item.geturi() when trying to share an image to Instagram

我使用的代码是他们在文档中使用过的代码:

  import { CameraRoll } from 'react-native';

  //get frist image from CameraRoll
  CameraRoll.getPhotos({first: 1}).then(
    function(data){

      const assets = data.edges

      SendIntentAndroid.isAppInstalled('com.instagram.android')
      .then(function(isInstalled){

        if(!isInstalled){
          //Instagram has not install
          return;
        }

        SendIntentAndroid.shareImageToInstagram("image/*", encodeURI(assets[0].node.image.uri));

      });


    },
    function(err){
      console.error('An error occurred', err)
    }
  );

任何人都可以帮我吗?我不需要使用该程序包,执行此操作的任何运行代码都可以帮助我。

0 个答案:

没有答案