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跳转

import { Linking } from 'react-native';


// 2、跳转代码
Linking.canOpenURL('weixin://').then(supported => { // weixin://  alipay://
     if (supported) {
        Linking.openURL('weixin://');
     } else {
     }
});

猜你喜欢

转载自blog.csdn.net/hahahhahahahha123456/article/details/81119837