Allow up to 10 images in share intent (#11132)

This commit is contained in:
Samuel Newman
2026-07-14 16:14:11 +03:00
committed by GitHub
parent 4778142ee8
commit 30e862bc26
2 changed files with 7 additions and 10 deletions
@@ -3,6 +3,7 @@ import AVKit
let IMAGE_EXTENSIONS: [String] = ["png", "jpg", "jpeg", "gif", "heic"]
let MOVIE_EXTENSIONS: [String] = ["mov", "mp4", "m4v"]
let MAX_IMAGES = 10
enum URLType: String, CaseIterable {
case image
@@ -71,17 +72,12 @@ class ShareViewController: UIViewController {
}
private func handleImages(items: [NSItemProvider]) async {
let firstFourItems: [NSItemProvider]
if items.count < 4 {
firstFourItems = items
} else {
firstFourItems = Array(items[0...3])
}
let itemsToProcess = Array(items.prefix(MAX_IMAGES))
var valid = true
var imageUris = ""
for (index, item) in firstFourItems.enumerated() {
for (index, item) in itemsToProcess.enumerated() {
var imageUriInfo: String?
do {
@@ -100,7 +96,7 @@ class ShareViewController: UIViewController {
if let imageUriInfo = imageUriInfo {
imageUris.append(imageUriInfo)
if index < items.count - 1 {
if index < itemsToProcess.count - 1 {
imageUris.append(",")
}
} else {
@@ -15,6 +15,7 @@ import java.io.FileOutputStream
import java.net.URLEncoder
private const val TAG = "ExpoReceiveAndroidIntents"
private const val MAX_IMAGES = 10
enum class AttachmentType {
IMAGE,
@@ -100,12 +101,12 @@ class ExpoReceiveAndroidIntentsModule : Module() {
intent
.getParcelableArrayListExtra(Intent.EXTRA_STREAM, Uri::class.java)
?.filterIsInstance<Uri>()
?.take(4)
?.take(MAX_IMAGES)
} else {
intent
.getParcelableArrayListExtra<Uri>(Intent.EXTRA_STREAM)
?.filterIsInstance<Uri>()
?.take(4)
?.take(MAX_IMAGES)
}
val text = intent.getStringExtra(Intent.EXTRA_TEXT)