Skip to content

Commit

Permalink
Customer chooser label
Browse files Browse the repository at this point in the history
Merged PR chirag04#42

(cherry picked from commit 563d90a)
  • Loading branch information
Nicolas Morel authored and nmorel committed Dec 18, 2017
1 parent 4dd97b6 commit 40fddb6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions android/src/main/java/com/chirag/RNMail/RNMailModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,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"));
Expand Down Expand Up @@ -116,7 +116,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 {
Expand Down

0 comments on commit 40fddb6

Please sign in to comment.