filter out files with non-image mime types
parent
f1d55f49fa
commit
8c7f813d87
|
@ -18,11 +18,18 @@ export async function openPicker(opts?: ImagePickerOptions) {
|
||||||
Toast.show('You may only select up to 4 images')
|
Toast.show('You may only select up to 4 images')
|
||||||
}
|
}
|
||||||
|
|
||||||
return (response.assets ?? []).slice(0, 4).map(image => ({
|
return (response.assets ?? [])
|
||||||
mime: 'image/jpeg',
|
.slice(0, 4)
|
||||||
height: image.height,
|
.filter(asset => {
|
||||||
width: image.width,
|
if (asset.mimeType?.startsWith('image/')) return true
|
||||||
path: image.uri,
|
Toast.show('Only image files are supported')
|
||||||
size: getDataUriSize(image.uri),
|
return false
|
||||||
}))
|
})
|
||||||
|
.map(image => ({
|
||||||
|
mime: 'image/jpeg',
|
||||||
|
height: image.height,
|
||||||
|
width: image.width,
|
||||||
|
path: image.uri,
|
||||||
|
size: getDataUriSize(image.uri),
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue