3.0.0 • Published 6 years ago

react-native-run-umshare v3.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

react-native-run-umshare

安装

 npm install react-native-run-umshare --save

关联原生

 react-native link 

将友盟下载的UMSocial 放在node-moudles - react-native-run-umshare - ios

command+option+a 将UMSocial添加到工程

#####添加依赖库 并配置平台

详情可查看友盟文档 友盟官网文档

在AppDelegate.m 添加
RNUMShare initKey:@""; 友盟平台APP key

使用

import UMShare from 'react-native-run-share'; //引入
componentDidMount() {
    UMShare.setPlatform(UMShare.Sina, key, secret, url);  //设置分享平台
}

/*分享*/
share = async() => {
 try  {
     await UMShare.setWebShare('测试网页分享',
  '测试网页分享',
'https://mobile.umeng.com/images/pic/home/social/img-1.png',
'https://www.baidu.com',
UMShare.Sina);

}
catch (err) {
console.log('error-===')
console.log(err);
}
}

###目前状况

目前新浪、微信、QQ可直接使用,如果需要添加其他平台,如下操作: 1. - node-module 文件下找到RNUMShare.m文件 2. - RNUMEnums 中添加相应平台 并在constantsToExport 方法中添加