Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

`allowsMultipleSelection: true` throws error in expo-image-picker (expo SDK 46)

$
0
0

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 doctorto 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, at expo-image-picker/plugin/tsconfig.json, this line was erroring: "extends": "expo-module-scripts/tsconfig.base" as the file was not found. So I manually installed expo-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>  )}

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>