react 调用 native 的callShareAllFunc()方法,实现分享


let shareName = {
'0': '微信',
'1': '朋友圈',
'2': '新浪微博',
'3': ' QQ',
'4': 'QQ空间'
};

render(){
//分享
YztApp.configureShare({
"title": encodeURIComponent(this.props.title),
"content": encodeURIComponent(
`${this.props.text && this.props.text.replace(/<[^>]+>/g, "").substring(0, 40)}...`),
"href": window.location.href,
"imgUrl": ''
}, true,
function (data) {
App.call(['getPeasForSharing'], null, null, {'activeId': 'ACT16062414010469018'});
YztApp.ubt('财经快讯', '选择分享渠道_点击_渠道', {'渠道': shareName[data.type], '分享结果': '成功'});
}, function (data) {
data = JSON.parse(data);
YztApp.ubt('财经快讯', '选择分享渠道_点击_渠道', {'渠道': shareName[data.type], '分享结果': '失败'});
});
}
<InputBox
onPressShare={() => {YztApp.callShareAllFunc();}}
/>
 
原文地址:https://www.cnblogs.com/y-lin/p/6005576.html