react-native - 无法在本机反应中共享图像
问题描述
我正在使用 react-native-share
import { Share } from 'react-native-share';
let options = {
message:"hello",
url:uri
}
Share.open(options);
我得到这个错误未定义不是评估_reactnative.Share.open的对象
解决方案
我已将下载的图像转换为 base64 字符串,然后传入 Share.options
import Share from 'react-native-share'; //Don't put curly braces
let options = {
message:"hello",
url:uri // pass base64 string like this "data:image/gif;base64,"+ base64 string
}
Share.open(options);
这种方法对我有用
推荐阅读
- c - 如何将通过函数调用传递的字符串分配给c中的变量
- python - 如何在python中“在一定时间内”编码?
- sql-server - 确定叶子细节链的分层查询
- time-series - 时间序列预测的特征缩放
- python - 如果我必须删除子数组中的最大元素,如何找到子数组的最大和
- ruby - 解析“Gemfile”时出错:未定义的局部变量或方法“init”
- azure - 如何从 Microsoft 托管代理虚拟机访问本地服务器?
- c - 用C语言反转循环双链表
- node.js - Serverless-offline 抛出“配置错误”或“无法读取未定义的属性‘选项’”
- flutter - Dart - 错误:需要声明,但得到'}'