New Edit Profile dialog on web, use new Edit Image dialog everywhere (#8220)
This commit is contained in:
@@ -1,35 +1,18 @@
|
||||
/// <reference lib="dom" />
|
||||
|
||||
import {type OpenCropperOptions} from 'expo-image-crop-tool'
|
||||
|
||||
import {unstable__openModal} from '#/state/modals'
|
||||
import {type PickerImage} from './picker.shared'
|
||||
import {type CameraOpts} from './types'
|
||||
|
||||
export {openPicker, type PickerImage as RNImage} from './picker.shared'
|
||||
export {openPicker} from './picker.shared'
|
||||
|
||||
export async function openCamera(_opts: CameraOpts): Promise<PickerImage> {
|
||||
// const mediaType = opts.mediaType || 'photo' TODO
|
||||
throw new Error('TODO')
|
||||
throw new Error('openCamera is not supported on web')
|
||||
}
|
||||
|
||||
export async function openCropper(
|
||||
opts: OpenCropperOptions,
|
||||
_opts: OpenCropperOptions,
|
||||
): Promise<PickerImage> {
|
||||
// TODO handle more opts
|
||||
return new Promise((resolve, reject) => {
|
||||
unstable__openModal({
|
||||
name: 'crop-image',
|
||||
uri: opts.imageUri,
|
||||
aspect: opts.aspectRatio,
|
||||
circular: opts.shape === 'circle',
|
||||
onSelect: (img?: PickerImage) => {
|
||||
if (img) {
|
||||
resolve(img)
|
||||
} else {
|
||||
reject(new Error('Canceled'))
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
throw new Error(
|
||||
'openCropper is not supported on web. Use EditImageDialog instead.',
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user