react-native-share 11.0.2 → 11.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,8 @@ import android.app.Activity;
4
4
  import android.content.ActivityNotFoundException;
5
5
  import android.content.Context;
6
6
  import android.content.Intent;
7
+ import android.content.ClipData;
8
+ import android.content.ClipDescription;
7
9
  import android.content.IntentSender;
8
10
  import android.content.pm.PackageManager;
9
11
  import android.net.Uri;
@@ -155,6 +157,14 @@ public abstract class ShareIntent {
155
157
  ShareFiles fileShare = getFileShares(options);
156
158
  if (fileShare.isFile()) {
157
159
  ArrayList<Uri> uriFile = fileShare.getURI();
160
+
161
+ ClipData clip = new ClipData(new ClipDescription("Files", new String[]{fileShare.getType()}), new ClipData.Item(uriFile.get(0)));
162
+
163
+ for (int i = 1; i < uriFile.size(); i++) {
164
+ clip.addItem(new ClipData.Item(uriFile.get(i)));
165
+ }
166
+
167
+ this.getIntent().setClipData(clip);
158
168
  this.getIntent().setAction(Intent.ACTION_SEND_MULTIPLE);
159
169
  this.getIntent().setType(fileShare.getType());
160
170
  this.getIntent().putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriFile);
@@ -173,7 +183,9 @@ public abstract class ShareIntent {
173
183
  this.fileShare = getFileShare(options);
174
184
  if (this.fileShare.isFile()) {
175
185
  Uri uriFile = this.fileShare.getURI();
186
+ ClipData clip = ClipData.newUri(this.reactContext.getContentResolver(), "File", uriFile);
176
187
  this.getIntent().setType(this.fileShare.getType());
188
+ this.getIntent().setClipData(clip);
177
189
  this.getIntent().putExtra(Intent.EXTRA_STREAM, uriFile);
178
190
  this.getIntent().addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
179
191
  if (!TextUtils.isEmpty(message)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-share",
3
3
  "description": "Social share, sending simple data to other apps.",
4
- "version": "11.0.2",
4
+ "version": "11.0.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/react-native-community/react-native-share.git"