'React Native Expo - how to get local uri to user's media library from image picker

I can't find how one would get (using expo packages) the local uri like file:///storage/emulated/0/DCIM/Camera/... from user picking an image from their media library without having to re-save/duplicate the image.
This gives me a paginated structure of user's photos and contains the uri I'd expect:

await MediaLibrary.getAssetsAsync({
    mediaType: [
        'photo',
    ],
});

However that does not open the media library, what does is:

await ImagePicker.launchImageLibraryAsync({
    mediaTypes: ImagePickerExpo.MediaTypeOptions.Images,
    presentationStyle: 0,
});

However uri here is something like file:///data/user/0/host.exp.exponent/cache/... which looks to me like an uri to a temporary cache, not the permanent uri to the local file.

Is there a way how to get the permanent media library uri from the image picker? (Without having to basically create your own gallery and picker using the getAssetsAsync() ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source