From ac70c24cfa63286f8ccea00bc85bbb11c182f785 Mon Sep 17 00:00:00 2001 From: GaryOoi Date: Tue, 28 Feb 2023 20:18:54 +0800 Subject: [PATCH] fix(android): DocumentPicker throw error [Error: User canceled document picker] (#630) Fix Error: User canceled document picker Issue with many different devices (Motorola G7, Huawei P30 Pro, Samsung Galaxy Note 9, Huawei P30...). All users with the problem have Android 10.0, but not all users with android 10 have this issue. --- .../com/reactnativedocumentpicker/DocumentPickerModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/reactnativedocumentpicker/DocumentPickerModule.java b/android/src/main/java/com/reactnativedocumentpicker/DocumentPickerModule.java index a0202185..a14f6c6d 100644 --- a/android/src/main/java/com/reactnativedocumentpicker/DocumentPickerModule.java +++ b/android/src/main/java/com/reactnativedocumentpicker/DocumentPickerModule.java @@ -141,7 +141,7 @@ public void pick(ReadableMap args, Promise promise) { boolean multiple = !args.isNull(OPTION_MULTIPLE) && args.getBoolean(OPTION_MULTIPLE); intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiple); - currentActivity.startActivityForResult(Intent.createChooser(intent, null), READ_REQUEST_CODE, Bundle.EMPTY); + currentActivity.startActivityForResult(intent, READ_REQUEST_CODE, Bundle.EMPTY); } catch (ActivityNotFoundException e) { sendError(E_UNABLE_TO_OPEN_FILE_TYPE, e.getLocalizedMessage()); } catch (Exception e) {