Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11, image picker doesn't have a selection after picking an image (from external storage) #551

Open
sommistica opened this issue Nov 22, 2023 · 5 comments

Comments

@sommistica
Copy link

sommistica commented Nov 22, 2023

The following error only seems to happen on Android 11. After imagepicker.present() and selecting an image from external storage the selection is empty. When picking an image from internal storage everything works as expected.

Setup and code:
I have tried with the following confuriations:
Image picker 2.0.2, and 3.0.0

/// 1
android.permission.READ_EXTERNAL_STORAGE
android.permission.MANAGE_EXTERNAL_STORAGE (and manually giving the app /// full permission) "

requestLegacyExternalStorage="true"
///

//// 2
android.permission.READ_EXTERNAL_STORAGE
requestLegacyExternalStorage="true"
////

/// 3
android.permission.READ_MEDIA_IMAGES
android.permission.READ_MEDIA_VIDEO
///

And
public pickImage(options?: OptionsCommon, hostView?: View): Promise {
// Create image picker
const p = imagePicker.create({
mode: 'single',
maximumNumberOfSelection: 1,
mediaType: ImagePickerMediaType.Image,
}, hostView); // Hostview is important to render on top of a modal

// Authorization is required (allow app to ...)
return p.authorize()
  .then(() => p.present()) // Present the imagepicker
  .then((selection) => {
    console.log(selection);
    const imagePickerSelection = selection[0];
    return Promise.all([Promise.resolve(imagePickerSelection.asset), isIOS ?
      ImageSource.fromAsset(imagePickerSelection.asset) : null]);
  })
  .then((f: [ImageAsset, ImageSource]) => this.processPickedImage(f, options))
  .catch(reason => Promise.reject(this.processPickingFailure(reason)));

}

on any other device then android 11, or when selecting from internal storage the console.log() prints the selection as expected.
When picking from external storage, and only on android 11 there is no selection.

@Aden-Kurmanov
Copy link

@sommistica Have you solved this problem?

@sommistica
Copy link
Author

@sommistica Have you solved this problem?

If I recall correctly I did, although I don't remember how anymore. I'll check the code tommorow to see, and if I actually did anything.

@Aden-Kurmanov
Copy link

@sommistica thanks

@sommistica
Copy link
Author

Hey. Sorry to disappoint you. I didn't touch the relevant bit of code anymore since this ticket. I am not at work atm, but i remember now that i created this ticket and put the bug in our app's backlog.

@Aden-Kurmanov
Copy link

@sommistica ok, it is sad
if i will find decision i send you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants