about summary refs log tree commit diff
path: root/src/state/models
diff options
context:
space:
mode:
authorOllie H <renahlee@outlook.com>2023-05-16 15:38:32 -0700
committerGitHub <noreply@github.com>2023-05-16 17:38:32 -0500
commit5f66adc9a656b79b76986395a73def9eed3d9776 (patch)
tree5c42de343a9cbe06bf382784f82c4e6930bbbe77 /src/state/models
parentd5bec4ff37fb3423b8f083dd9fe95c066b4cf90e (diff)
downloadvoidsky-5f66adc9a656b79b76986395a73def9eed3d9776.tar.zst
Replace image picker with expo-image-picker (#649)
* Replace image picker with expo-image-picker

* Fix cropper & picker on web

---------

Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/state/models')
-rw-r--r--src/state/models/media/gallery.ts10
-rw-r--r--src/state/models/media/image.ts2
2 files changed, 8 insertions, 4 deletions
diff --git a/src/state/models/media/gallery.ts b/src/state/models/media/gallery.ts
index 89f0d0129..67f8d2ea1 100644
--- a/src/state/models/media/gallery.ts
+++ b/src/state/models/media/gallery.ts
@@ -102,10 +102,14 @@ export class GalleryModel {
 
   async pick() {
     const images = await openPicker(this.rootStore, {
-      multiple: true,
-      maxFiles: 4 - this.images.length,
+      selectionLimit: 4 - this.size,
+      allowsMultipleSelection: true,
     })
 
-    await Promise.all(images.map(image => this.add(image)))
+    return await Promise.all(
+      images.map(image => {
+        this.add(image)
+      }),
+    )
   }
 }
diff --git a/src/state/models/media/image.ts b/src/state/models/media/image.ts
index 6edf88d9d..ec93bf5b6 100644
--- a/src/state/models/media/image.ts
+++ b/src/state/models/media/image.ts
@@ -135,7 +135,7 @@ export class ImageModel implements RNImage {
   // Only for mobile
   async crop() {
     try {
-      const cropped = await openCropper(this.rootStore, {
+      const cropped = await openCropper({
         mediaType: 'photo',
         path: this.path,
         freeStyleCropEnabled: true,