Error: Failed to read picked image → Caused by: Cannot load representation of type public.jpeg

507 Views Asked by At

I am trying to upload multiple images to my firebase storage using expo image picker but I always run into an error every time I select images of which I have no idea what could be causing it. The error is that the images does not get previewed in my image view with this log error

Error: Failed to read picked image → Caused by: Cannot load representation of type public.jpeg

this is my code where I access photo library

 const pickImage = async () => {
// No permissions request is necessary for launching the image library
let result = await ImagePicker.launchImageLibraryAsync({
  mediaTypes: ImagePicker.MediaTypeOptions.Images,
  //allowsEditing: true,
  allowsMultipleSelection: true,
  aspect: [4, 3],
  quality: 1,
})

console.log(result);

if (!result.cancelled) {
  setImage(result.uri ? [result.uri] : result.selected);

 }
};

and this is where I try to preview selected images with flatlist

<ScrollView>
  
  <FlatList
  data={image}
  renderItem = {({item}) => (
    <Image source={{ uri: item.uri }}
    style={{width: 100, height: 100}}
      />
  )} 
  keyExtractor={(item) => item.uri }
  />

  </ScrollView>
1

There are 1 best solutions below

0
On

If you are using the iOS simulator, do not use the default images in the photo library, upload/download your own images and make use of those.

I fixed my issues with this step.