Image index fix (#15525)

* image index fix
This commit is contained in:
Omar Basem 2023-03-29 22:12:38 +04:00 committed by GitHub
parent a441156ff9
commit 0503f5cfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -126,6 +126,11 @@
(when (string? s) (when (string? s)
(string/replace s m r))) (string/replace s m r)))
(defn safe-nth
[coll index]
(when (number? index)
(nth coll index)))
(defn svg? (defn svg?
[some-string] [some-string]
(string/ends-with? some-string ".svg")) (string/ends-with? some-string ".svg"))

View File

@ -130,7 +130,7 @@
;; The initial value of data is the image that was pressed (and not the whole album) in order ;; The initial value of data is the image that was pressed (and not the whole album) in order
;; for the transition animation to execute properly, otherwise it would animate towards ;; for the transition animation to execute properly, otherwise it would animate towards
;; outside the screen (even if we have `initialScrollIndex` set). ;; outside the screen (even if we have `initialScrollIndex` set).
data (reagent/atom [(nth messages index)]) data (reagent/atom (if (number? index) [(nth messages index)] []))
scroll-index (reagent/atom index) scroll-index (reagent/atom index)
transparent? (reagent/atom false) transparent? (reagent/atom false)
set-full-height? (reagent/atom false) set-full-height? (reagent/atom false)