about summary refs log tree commit diff
path: root/src/state/models/shell-ui.ts
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-01-17 20:40:02 -0600
committerGitHub <noreply@github.com>2023-01-17 20:40:02 -0600
commit065d7ef629c7d991e520fc3dd94cd84b71014902 (patch)
tree89ed72702a5af85eb8508682edc9f2281d23c2e5 /src/state/models/shell-ui.ts
parent61682d5846523038d9a28f851d2bd7c16d27a4a9 (diff)
downloadvoidsky-065d7ef629c7d991e520fc3dd94cd84b71014902.tar.zst
Improve lightbox... and update to React Native 0.71.0 (#49)
* Switch to a better lightbox implementation (close #42)

* Upgrade to react-native 0.71.0

* Update (or remove low-value) tests
Diffstat (limited to 'src/state/models/shell-ui.ts')
-rw-r--r--src/state/models/shell-ui.ts43
1 files changed, 4 insertions, 39 deletions
diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts
index 1af74f56a..7628e068f 100644
--- a/src/state/models/shell-ui.ts
+++ b/src/state/models/shell-ui.ts
@@ -52,55 +52,22 @@ export class ReportAccountModal {
   }
 }
 
-interface LightboxModel {
-  canSwipeLeft: boolean
-  canSwipeRight: boolean
-  onSwipeLeft: () => void
-  onSwipeRight: () => void
-}
+interface LightboxModel {}
 
 export class ProfileImageLightbox implements LightboxModel {
   name = 'profile-image'
-  canSwipeLeft = false
-  canSwipeRight = false
   constructor(public profileView: ProfileViewModel) {
     makeAutoObservable(this)
   }
-  onSwipeLeft() {}
-  onSwipeRight() {}
-}
-
-export class ImageLightbox implements LightboxModel {
-  name = 'image'
-  canSwipeLeft = true
-  canSwipeRight = true
-  constructor(public uri: string) {
-    makeAutoObservable(this)
-  }
-  onSwipeLeft() {}
-  onSwipeRight() {}
 }
 
 export class ImagesLightbox implements LightboxModel {
   name = 'images'
-  get canSwipeLeft() {
-    return this.index > 0
-  }
-  get canSwipeRight() {
-    return this.index < this.uris.length - 1
-  }
   constructor(public uris: string[], public index: number) {
     makeAutoObservable(this)
   }
-  onSwipeLeft() {
-    if (this.canSwipeLeft) {
-      this.index = this.index - 1
-    }
-  }
-  onSwipeRight() {
-    if (this.canSwipeRight) {
-      this.index = this.index + 1
-    }
+  setIndex(index: number) {
+    this.index = index
   }
 }
 
@@ -187,9 +154,7 @@ export class ShellUiModel {
     this.activeModal = undefined
   }
 
-  openLightbox(
-    lightbox: ProfileImageLightbox | ImageLightbox | ImagesLightbox,
-  ) {
+  openLightbox(lightbox: ProfileImageLightbox | ImagesLightbox) {
     this.isLightboxActive = true
     this.activeLightbox = lightbox
   }