首页 > 解决方案 > 与 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" });

预期的行为

该应用程序应共享图像以及消息“活动邀请”

当前行为

应用只分享“活动邀请”消息,看不到图片也不分享

标签: react-nativeexpo

解决方案


内容“网址”仅适用于 iOS。如果你想分享图像android,你可以看看这个链接


推荐阅读