From 563d90a72f76ef7e35965d8f4b8df0eadf65f8a4 Mon Sep 17 00:00:00 2001 From: Nicolas Morel Date: Tue, 21 Feb 2017 16:19:56 +0100 Subject: [PATCH] Customer chooser label Merged PR https://github.com/chirag04/react-native-mail/pull/42 --- .../src/main/java/com/chirag/RNMail/RNMailModule.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/chirag/RNMail/RNMailModule.java b/android/src/main/java/com/chirag/RNMail/RNMailModule.java index 5ba6b6b..9407871 100644 --- a/android/src/main/java/com/chirag/RNMail/RNMailModule.java +++ b/android/src/main/java/com/chirag/RNMail/RNMailModule.java @@ -54,7 +54,7 @@ private String[] readableArrayToStringArray(ReadableArray r) { @ReactMethod public void mail(ReadableMap options, Callback callback) { Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); - i.setType("text/plain"); + i.setType("vnd.android.cursor.dir/email"); if (options.hasKey("subject") && !options.isNull("subject")) { i.putExtra(Intent.EXTRA_SUBJECT, options.getString("subject")); @@ -110,7 +110,13 @@ public void mail(ReadableMap options, Callback callback) { callback.invoke("error"); } } else { - Intent chooser = Intent.createChooser(i, "Send Mail"); + String chooserLabel; + if (options.hasKey("chooserLabel") && !options.isNull("chooserLabel")) { + chooserLabel = options.getString("chooserLabel"); + } else { + chooserLabel = "Send Mail"; + } + Intent chooser = Intent.createChooser(i, chooserLabel); chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try {