Skip to content

Commit 40fddb6

Browse files
Nicolas Morelnmorel
Nicolas Morel
authored andcommitted
Customer chooser label
Merged PR chirag04#42 (cherry picked from commit 563d90a)
1 parent 4dd97b6 commit 40fddb6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

android/src/main/java/com/chirag/RNMail/RNMailModule.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private String[] readableArrayToStringArray(ReadableArray r) {
5555
@ReactMethod
5656
public void mail(ReadableMap options, Callback callback) {
5757
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
58-
i.setType("text/plain");
58+
i.setType("vnd.android.cursor.dir/email");
5959

6060
if (options.hasKey("subject") && !options.isNull("subject")) {
6161
i.putExtra(Intent.EXTRA_SUBJECT, options.getString("subject"));
@@ -116,7 +116,13 @@ public void mail(ReadableMap options, Callback callback) {
116116
callback.invoke("error");
117117
}
118118
} else {
119-
Intent chooser = Intent.createChooser(i, "Send Mail");
119+
String chooserLabel;
120+
if (options.hasKey("chooserLabel") && !options.isNull("chooserLabel")) {
121+
chooserLabel = options.getString("chooserLabel");
122+
} else {
123+
chooserLabel = "Send Mail";
124+
}
125+
Intent chooser = Intent.createChooser(i, chooserLabel);
120126
chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
121127

122128
try {

0 commit comments

Comments
 (0)