Use expo-image-picker on Web (#847)

This commit is contained in:
Logan Rosen 2023-06-06 10:38:58 -04:00 committed by GitHub
parent a67eaa6ace
commit bdcdb4e4dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 97 deletions

View file

@ -5,12 +5,7 @@ import {
} from 'react-native-image-crop-picker'
import {RootStoreModel} from 'state/index'
import {CameraOpts, CropperOptions} from './types'
import {
ImagePickerOptions,
launchImageLibraryAsync,
MediaTypeOptions,
} from 'expo-image-picker'
import {getDataUriSize} from './util'
export {openPicker} from './picker.shared'
/**
* NOTE
@ -21,26 +16,6 @@ import {getDataUriSize} from './util'
* -prf
*/
export async function openPicker(
_store: RootStoreModel,
opts?: ImagePickerOptions,
) {
const response = await launchImageLibraryAsync({
exif: false,
mediaTypes: MediaTypeOptions.Images,
quality: 1,
...opts,
})
return (response.assets ?? []).map(image => ({
mime: 'image/jpeg',
height: image.height,
width: image.width,
path: image.uri,
size: getDataUriSize(image.uri),
}))
}
export async function openCamera(
_store: RootStoreModel,
opts: CameraOpts,