New Edit Profile dialog on web, use new Edit Image dialog everywhere (#8220)

This commit is contained in:
Samuel Newman
2025-05-06 22:50:28 +03:00
committed by GitHub
parent 3f7dc9a8e5
commit 4c8fd006f6
21 changed files with 532 additions and 441 deletions
+6 -23
View File
@@ -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.',
)
}