From a5a21855d3a0cfdb91c0cd84805b4ffc9f62d494 Mon Sep 17 00:00:00 2001 From: xuxiaoqain01 Date: Tue, 6 Aug 2024 09:18:27 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=20[Issues:=20#IAA8NO]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native-mail=E6=8C=87=E5=AF=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/react-native-mail.md | 116 +++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 55 deletions(-) diff --git a/zh-cn/react-native-mail.md b/zh-cn/react-native-mail.md index 14d01153..3505174a 100644 --- a/zh-cn/react-native-mail.md +++ b/zh-cn/react-native-mail.md @@ -1,5 +1,3 @@ - - > 模板版本:v0.2.2

@@ -24,7 +22,7 @@ 进入到工程目录并输入以下命令: ->[!TIP] # 处替换为 tgz 包的路径 +> [!TIP] # 处替换为 tgz 包的路径 @@ -47,46 +45,56 @@ yarn add @react-native-oh-tpl/react-native-mail@file:# > [!WARNING] 使用时 import 的库名不变。 ```jsx -import React, { Component } from 'react'; -import { View, Alert, Button } from 'react-native'; -import Mailer from 'react-native-mail'; +import React, { Component } from "react"; +import { View, Alert, Button } from "react-native"; +import Mailer from "react-native-mail"; export default class App extends Component { - handleEmail = () => { - Mailer.mail({ - subject: 'need help', - recipients: ['support@example.com'], - ccRecipients: ['supportCC@example.com'], - bccRecipients: ['supportBCC@example.com'], - body: 'A Bold Body', - customChooserTitle: 'This is my new title', // Android only (defaults to "Send Mail") - isHTML: true, - attachments: [{ - // Specify either `path` or `uri` to indicate where to find the file data. - path: '', // /data/storage/el2/base/haps/entry/files/11.png - uri: '', // file:///data/storage/el2/base/haps/entry/files/11.png - // Specify either `type` or `mimeType` to indicate the type of data. - type: '', // Mime Type: jpg, png, doc, ppt, html, pdf, csv - mimeType: '', // - use only if you want to use custom type - name: '', // Optional: Custom filename for attachment - }] - }, (error, event) => { - Alert.alert( - error, - event, - [ - {text: 'Ok', onPress: () => console.log('OK: Email Error Response')}, - {text: 'Cancel', onPress: () => console.log('CANCEL: Email Error Response')} + Mailer.mail( + { + subject: "need help", + recipients: ["support@example.com"], + ccRecipients: ["supportCC@example.com"], + bccRecipients: ["supportBCC@example.com"], + body: "A Bold Body", + customChooserTitle: "This is my new title", // Android only (defaults to "Send Mail") + isHTML: true, + attachments: [ + { + // Specify either `path` or `uri` to indicate where to find the file data. + path: "", // /data/storage/el2/base/haps/entry/files/11.png + uri: "", // file:///data/storage/el2/base/haps/entry/files/11.png + // Specify either `type` or `mimeType` to indicate the type of data. + type: "", // Mime Type: jpg, png, doc, ppt, html, pdf, csv + mimeType: "", // - use only if you want to use custom type + name: "", // Optional: Custom filename for attachment + }, ], - { cancelable: true } - ) - }); - } + }, + (error, event) => { + Alert.alert( + error, + event, + [ + { + text: "Ok", + onPress: () => console.log("OK: Email Error Response"), + }, + { + text: "Cancel", + onPress: () => console.log("CANCEL: Email Error Response"), + }, + ], + { cancelable: true } + ); + } + ); + }; render() { return ( - +