ImagePicker with Modal stops working after iOS 14.5.0 update

Platforms: iOS 14.5, iPhone 8

Tried with:
Expo SDK 40, expo-image-picker 9.2.0
Expo SDK 41, expo-image-picker 10.1.4

I had a working ImagePicker giving the user the media gallery or camera up until this week when i updated my iphone 8 to iOS 14.5.0, and also 14.5.1.

The problem is related to Expo’s Modal component, because I have one open (full screen) which is giving the user the buttons for opening the media library or camera. I have another screen without the modal, and the ImagePicker works as expected. Additionally, I don’t have any problems with this combination (Modal + ImagePicker) under Android, it works as expected as well.

With the Modal visible, ImagePicker.requestMediaLibraryPermissionsAsync() returns a completely good looking MediaLibraryPermissionResponse that is this:

Object {
  "accessPrivileges": "all",
  "canAskAgain": true,
  "expires": "never",
  "granted": true,
  "status": "granted",
}

and no exceptions are thrown. But ImagePicker.launchImageLibraryAsync() just does not launch anything.

Does anyone know about this, and is it fixable (without rewriting my gui to not use a Modal)?
Thanks much.

update: I just upgraded to SDK 41 and the problem persists with that version too.

1 Like

Hey @kurtak, we’re aware of this issue and will be tracking it on Github here. Also, there is a proposed workaround from someone from the community that is likely worth exploring until we can resolve this issue.

Cheers,
Adam

@adamjnav Ok, great. Thanks for the timely response!

Hi Expo Team,
This is really a big bug for our users. They aren’t able to post pics now. Please please fix this asap. Sincerely request the team for a fix.

Hi Expo Team,
This is really a big bug for our users. Please fix this issue asap.

is there an issue on Issues · expo/expo · GitHub for this? this pr fixes a known ios 14.5.0 imagepicker bug, this requires that you update expo go to the latest version and do a new build of your standalone app. it was deployed about two weeks ago.

Hi @notbrent, Yes, there is a (closed) github issue link in the very first response, that has a bit of discussion about it.
best,
k

that issue is fixed by the pr i referenced above - [image-picker] fix: view being transparent on iOS 14.5 by cruzach · Pull Request #12897 · expo/expo · GitHub

a temporary solution could be this one:

addFromCameraRoll = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
quality: 1,
});
… your code …
}

this.setState({ modalVisible: false });
let timeout = Platform.OS == “ios” ? 1000 : 10;
setTimeout(() => this.addFromCameraRoll(), timeout);

P.S.: If you reduce timeout on iOS, the probability that this error occurs grow up. 1000 ms should be ok.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.