react-native - 与 EXPO 共享图像
问题描述
我搜索了很多,看起来这个过程在使用 Expo 时并不直接
看来我需要在本地下载文件,然后共享它
import {Share} from 'react-native';
const imageURL = "https://i.imgur.com/7RhCHg2.png";
const url = await downloadAsync(imageURL , cacheDirectory + "tmp.png");
console.log(url); // it prints a local image file
Share.share({url : url.uri , message : "Event Invitation" });
预期的行为
该应用程序应共享图像以及消息“活动邀请”
当前行为
应用只分享“活动邀请”消息,看不到图片也不分享
解决方案
内容“网址”仅适用于 iOS。如果你想分享图像android,你可以看看这个链接
推荐阅读
- angular - 当我从 tab1 的子页面跳转到 tab2 的子页面时,离子后退按钮不带我到上一页
- android - 我是否需要在自定义视图中清除/清空我的视图绑定字段?
- javascript - 循环遍历数组,计算平均值,并在对象中返回结果
- node.js - 如何在节点中使用 ssl 制作服务器?
- c# - Xamarin - 如何使用 MVVM 和数据库绑定标签
- powerbi - 如何从共享点站点将多列转换为文本?
- reactjs - 当我触发 onClick 时 useState 不切换类
- html - 设置一个 web 服务器,将 index.html 上传到 ftp 服务器
- python - 在 matplotlib 中为注释框指定固定宽度
- sql - Redshift:使用另一个带有 JOIN 的表与没有 JOIN 的表更新一个表