如何格式在WhatsApp React本地发送文本

发布于 2025-02-08 15:01:49 字数 503 浏览 2 评论 0原文

我想要的是发送以对象形式编写的数据,就像商店有收据一样,我的代码是

 var date = new Date().getDate();
      const UploadDataCredentials = {
        user_id: user_id,
        user_detail: [Name, Phone, Address],
        order_detail: Data,
        total_price: TotalPrice,
        order_time: date,
        status: 'Pending',
      };

  Linking.openURL(`whatsapp://send?text=${JSON.stringify(UploadDataCredentials)}&phone=+923354584582`)
      props.navigation.replace(navigationstring.BOTTOMTABHOME);

What I wanted is to send data that is written in object form in proper formate like stores have receipt my code is

 var date = new Date().getDate();
      const UploadDataCredentials = {
        user_id: user_id,
        user_detail: [Name, Phone, Address],
        order_detail: Data,
        total_price: TotalPrice,
        order_time: date,
        status: 'Pending',
      };

  Linking.openURL(`whatsapp://send?text=${JSON.stringify(UploadDataCredentials)}&phone=+923354584582`)
      props.navigation.replace(navigationstring.BOTTOMTABHOME);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

西瓜 2025-02-15 15:01:49

因此,最终我知道我的问题代码的答案在

 onPress={() => {
        Linking.openURL(`whatsapp://send?text=${` Hey Dear in am intrusted in that Book  \n\n\n Name : ${item.name} \n\n Book Info : ${!!item.info ? item.info : item.desc} \n\n Price : ${price}`}&phone=+923354584582`)
      }}>

这里 /n代表下一行
您可以在文本中使用您想要的任何形式的whatsapp输出消息。

so final i know answer of my question code is below

 onPress={() => {
        Linking.openURL(`whatsapp://send?text=${` Hey Dear in am intrusted in that Book  \n\n\n Name : ${item.name} \n\n Book Info : ${!!item.info ? item.info : item.desc} \n\n Price : ${price}`}&phone=+923354584582`)
      }}>

here /n represent Next line
you can formate whatsapp output message with any formate you want in text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文