Cannot Linking. openURL whatsup message in react native

天涯浪子 提交于 2019-12-13 02:54:34

问题


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));

I receive the error message: "{"framestopop:1,code:EUNSPECIFIED"}"

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


回答1:


You need to use the below code

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


来源:https://stackoverflow.com/questions/50928633/cannot-linking-openurl-whatsup-message-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!