如何在 reactjs 中使用 react-share 在 Twitter 上分享图像



我无法使用react-share在Twitter上分享图像。我的代码是:

<TwitterShareButton 
     url={window.location.href} 
     title={props.data.breadcrumb}
     imageURL={props.data.product_info.image_path}
     children={<TwitterIcon size={32} round={true} />}
/>

正在从 API 加载映像。我已将图像URL更改为媒体,但它仍然无法正常工作。我可以分享图片吗?

似乎您可以将其作为此响应中的 base64 url 共享 https://github.com/react-native-community/react-native-share/issues/119 这非常酷且简单。

所以基本上设置网址属性:

url: "data:image/png;base64,<base64_data>"

最新更新