Fix cropper crashing after clicking cancel
This commit is contained in:
parent
ae26963b45
commit
ebd333b331
1 changed files with 1 additions and 3 deletions
|
@ -13,15 +13,13 @@ export async function openCamera(_opts: CameraOpts): Promise<RNImage> {
|
||||||
|
|
||||||
export async function openCropper(opts: CropperOptions): Promise<RNImage> {
|
export async function openCropper(opts: CropperOptions): Promise<RNImage> {
|
||||||
// TODO handle more opts
|
// TODO handle more opts
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(resolve => {
|
||||||
unstable__openModal({
|
unstable__openModal({
|
||||||
name: 'crop-image',
|
name: 'crop-image',
|
||||||
uri: opts.path,
|
uri: opts.path,
|
||||||
onSelect: (img?: RNImage) => {
|
onSelect: (img?: RNImage) => {
|
||||||
if (img) {
|
if (img) {
|
||||||
resolve(img)
|
resolve(img)
|
||||||
} else {
|
|
||||||
reject(new Error('Canceled'))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue