Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 无法在React本机共享中共享产品的映像_React Native - Fatal编程技术网

React native 无法在React本机共享中共享产品的映像

React native 无法在React本机共享中共享产品的映像,react-native,React Native,我正在使用react native share共享产品描述、url和图像。但是,它不工作并将附件显示为somename.null。 我从response中获取base64映像。代码写在下面 shareProduct = () => { console.log(this.props.productDetails); let { name, product_url, base64 } = this.props.productDetails; const shareOp

我正在使用react native share共享产品描述、url和图像。但是,它不工作并将附件显示为somename.null。 我从response中获取base64映像。代码写在下面

shareProduct = () => {
    console.log(this.props.productDetails);
    let { name, product_url, base64 } = this.props.productDetails;

    const shareOptions = {
      title: "Testing APP",
      url: product_url,
      message: "This is the testing. Please check",
      subject: name
    };
    if( base64 !== "" && base64 !== undefined ){
      shareOptions.url = base64;
      shareOptions.type   = 'image/jpeg';
    }
    Share.open(shareOptions)
      .then(res => {})
      .catch(err => {
        console.log(err);
      });
  };
请帮我找出我错的地方


您需要在选项中更改url:

Share.open(
{
消息:“这是测试,请检查”,
标题:“股份”,
url:product_url,
键入:“image/jpg”,
activityItemSources:[
{
链接元数据:{image:`data:image/jpg;base64,${product\u url}`,
},
],
},
{
//仅限Android:
dialogTitle:“共享”,
//仅限iOS:
excludedActivityTypes:['com.apple.UIKit.activity.posttowitter'],
},

);您需要在选项中更改url:

Share.open(
{
消息:“这是测试,请检查”,
标题:“股份”,
url:product_url,
键入:“image/jpg”,
activityItemSources:[
{
链接元数据:{image:`data:image/jpg;base64,${product\u url}`,
},
],
},
{
//仅限Android:
dialogTitle:“共享”,
//仅限iOS:
excludedActivityTypes:['com.apple.UIKit.activity.posttowitter'],
},

);
shareOptions.url
中,您是在共享图像的实际url还是Base64?@Rajan是的,我在API调用后得到响应,在API调用中我得到jpg格式的Base64图像,然后在共享选项中传递它。这不是图像url,而是Base64格式。在
shareOptions.url
中,您是在共享图像的实际url还是Base64?@Rajan是的,我在API调用后得到响应,其中我得到jpg格式的Base64图像,然后在共享选项中传递它。这不是图像url,而是Base64格式。上面的代码不起作用。我以前试过。上面的代码不起作用。我以前试过。