react-native 打开微信等其他App

一、常用URL Scheme

QQ: mqq:// 
微信: weixin:// 
新浪微博: weibo:// (sinaweibo://) 
腾讯微博: tencentweibo:// 
淘宝: taobao:// 
支付宝: alipay:// 
美团: imeituan:// 
知乎: zhihu:// 
优酷: youku://

二、配置Scheme白名单(仅ios,Android平台不需要)

  • 在项目的info.plist中添加一LSApplicationQueriesSchemes,类型为Array。
  • 添加需要支持的项目,类型为字符串类型;

LSApplicationQueriesSchemes

三、Linking跳转

 1 // 1、导入
 2 import { Linking } from 'react-native';
 3 
 4 
 5 // 2、跳转代码
 6 Linking.canOpenURL('weixin://').then(supported => { // weixin://  alipay://
 7   if (supported) {
 8     Linking.openURL('weixin://');
 9   } else {
10     toastShort(`请先安装XXX`);
11   }
12 });

 

转载自:http://blog.csdn.net/mqy1023/article/details/53897605

posted @ 2017-05-03 10:52  老颤  阅读(3570)  评论(0编辑  收藏  举报