是否可以在mailto url中添加新行? [英] Is it possible to add a new line in mailto url?
本文介绍了是否可以在mailto url中添加新行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用我的 react-native 应用程序中的 mailto
url 打开电子邮件客户端.
I am trying to open an email client with mailto
url from my react-native app.
用于打开客户端的代码片段:
Code snippet used for opening a client:
const body = 'my email\nbody';
Linking.openURL(`mailto:email@example.com?subject=${subject}&body=${encodeURIComponent(body)}`);
电子邮件客户端正在打开(Android、Gmail),但未呈现换行符.
The email client is opening (Android, Gmail), but no newlines are rendered.
我也尝试过使用 %0D%0A
和 \r\n
,但没有结果.
I have also tried to use %0D%0A
and \r\n
, but no results.
是否可以在 react-native 的 mailto
中添加新行?
Is it possible to add new lines in mailto
in react-native?
反应原生:0.61.0
react-native: 0.61.0
安卓:9
推荐答案
只需使用普通的旧
标签.
Just use plain old <br>
tag.
示例:
string newLine = `<br>`;
let body = 'Hi,'
+ newLine
+ 'This will come after 1 Line'
+ newLine +newLine + 'This will come after 2 Lines';
默认邮件应用中的输出:
Output in default mail app :
这篇关于是否可以在mailto url中添加新行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文