简体   繁体   English

React Native共享base64映像不起作用

[英]React Native sharing base64 image is not working

I am developing on android. 我在android上开发。 My react-native version is 0.42 . 我的本机版本是0.42 I'm using react-native-share package for sharing screen view. 我正在使用react-native-share软件包共享屏幕视图。 The data I want to share is being converted to base64. 我要共享的数据已转换为base64。

...
const uri = "data:image/jpeg;base64,...";

Share.open({
  title: "Title",
  message: "Message",
  url: uri,
  subject: "Mail subject"
})
...

This process was working properly on whatsapp, facebook and email before. 之前,此过程在whatsapp,facebook和电子邮件上正常运行。 However, now, when I tried on whatsapp the response is 'Sharing failed. 但是,现在,当我尝试使用whatsapp时,响应为“共享失败。 Please try again' , on facebook I'm getting an empty text area without sharing options and on email I'm getting the text typed options except for the image. 请重试” ,在facebook上,我得到一个空白的文本区域,没有共享选项;在电子邮件上,我得到了文本输入的选项(图像除外)。

Do you have any suggestion? 你有什么建议吗? Thank you. 谢谢。

I am using react-native-share but using the shareSingle option like this: 我正在使用react-native-share但使用了shareSingle选项,如下所示:

Share.shareSingle({
  message:'I just added a new outfit to my album.',
  url:Constants.image64, //base64 image
  social: "whatsapp"
});

It works great on both the platforms. 它在两个平台上都很好用。 You can try it if it suffice your needs. 如果满足您的需要,可以尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM