无法在React Native中共享图像

时间:2018-10-23 14:50:56

标签: react-native react-native-android

我正在使用react-native-share

import { Share } from 'react-native-share';   
let options = {
message:"hello",
url:uri
}
Share.open(options);
  

我无法定义此错误不是评估_reactnative.Share.open

的对象

2 个答案:

答案 0 :(得分:0)

尝试用import Share from 'react-native-share';代替import { Share } from 'react-native-share';

答案 1 :(得分:0)

我已将下载的图像转换为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);
  

此方法对我有用