expo-image-picker: support preselected assets (PHPickerConfiguration.preselectedAssetIdentifiers)
Nicolas Müller Noulezas
Summary
expo-image-picker currently always opens the system picker with an empty selection state. There is no way to pre-check previously selected assets when reopening the picker (e.g. when the user taps "Change selection" after already picking photos).
On iOS, the underlying PHPickerViewController supports this natively via PHPickerConfiguration.preselectedAssetIdentifiers (iOS 15+), but expo-image-picker does not expose any option to pass preselected asset IDs.
Use case
A common pattern in photo apps is to let users pick multiple photos, review them, and then reopen the picker to add/remove items. Users expect their previous selection to still be checked inside the native picker, not to have to reselect everything from scratch.
Requested API
Add an optional field to ImagePickerOptions, e.g.:
- preselectedAssetIdentifiers?: string[]; // asset IDs to pre-check in the picker
Behavior:
- On iOS, map this to PHPickerConfiguration.preselectedAssetIdentifiers.
- On Android, either no-op (if no equivalent exists) or use the closest available equivalent.
References
- Apple PHPickerConfiguration.preselectedAssetIdentifiers: https://developer.apple.com/documentation/photokit/phpickerconfiguration/preselectedassetidentifiers
- expo-image-picker docs (no such option exists today): https://docs.expo.dev/versions/latest/sdk/imagepicker/