I have no problem selecting one image at a time with allowsMultipleSelection: false
. But with allowsMultipleSelection: true
, it throws an error.
Note: I do have allowsEditing: false
.
What's happening
I get this error: "code":"ERR_INVALID_MEDIA_TYPE","message":"Cannot handle 'public.jpeg' media type"
Not sure where 'public.jpeg' comes from as I am selecting, from my IPhone simulator (iOS 15.5), different types of pictures from different albums, and the error is the same for any picture I select.
I do not have this error when allowsMultipleSelection: false
.
Context:
React 18
Expo SDK 46
Expo-image-picker": "~13.3.1",
iOS 15.5 Iphone Simulator
Typescript: 4.8.2
Things I've tried
- I ran
expo doctor
to check if dependencies problems but there are none. - Tried adding other options such as
base64: true
, different qualities, etc - Note: when I opened the
node_modules
folder, atexpo-image-picker/plugin/tsconfig.json
, this line was erroring:"extends": "expo-module-scripts/tsconfig.base"
as the file was not found. So I manually installedexpo-module-scripts
and now the error is gone, with the line"extends": "expo-module-scripts/tsconfig.plugin"
generated instead. The above did not change anything though - I get the same error on selecting multiple images (ERR_INVALID_MEDIA_TYPE
).
Packages:
Minimal reproducible example
import React from 'react'
import { launchImageLibraryAsync, MediaTypeOptions } from 'expo-image-picker'
import { View, Button } from 'react-native'
export function GalleryImagesForm(props) {
const pickImages = async () => {
// No permissions request is necessary for launching the image library
try {
let result = await launchImageLibraryAsync({
mediaTypes: MediaTypeOptions.All,
allowsMultipleSelection: true,
})
console.log(result)
} catch (error) {
console.log(error)
}
}
return (
<View>
<Button title="Pick an image from camera roll" onPress={pickImages} />
</View>
)
}