无法链接. openURL whatsup消息在本机反应 [英] Cannot Linking. openURL whatsup message in react native

查看:136
本文介绍了无法链接. openURL whatsup消息在本机反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用预加载的消息打开whatsup,如下所示:

I need to open whatsup with a preloaded message, like this:

Linking.openURL('whatsapp://send?text==%C2%A1Hola!%20Quiero%20realizar%20una%20consulta.&phone=5493416931539').catch(err => console.error('An error occurred', err));

我收到错误消息:"{"framestopop:1,code:EUNSPECIFIED"}"

我已经尝试过.catch(() => null);,但是两者都不起作用.

I've tried with .catch(() => null); but doesn't work neither.

推荐答案

您需要使用以下代码

import { Linking } from ‘react-native’;
shareToWhatsAppWithContact = (text, phoneNumber) => {
 Linking.openURL(`whatsapp://send?text=${text}&phone=${phoneNumber}`);
}

这篇关于无法链接. openURL whatsup消息在本机反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆