Skip to content

Commit

Permalink
remove image delay
Browse files Browse the repository at this point in the history
  • Loading branch information
OmarBasem committed Mar 21, 2023
1 parent ada7a02 commit ee0df86
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
11 changes: 9 additions & 2 deletions src/status_im2/contexts/chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
[status-im2.contexts.contacts.events :as contacts-store]
[status-im.multiaccounts.model :as multiaccounts.model]
[status-im.utils.clocks :as utils.clocks]
[status-im.utils.types :as types]))
[status-im.utils.types :as types]
[reagent.core :as reagent]))

(defn- get-chat
[cofx chat-id]
Expand Down Expand Up @@ -338,6 +339,13 @@
[{:keys [db]} shared-element-id]
{:db (assoc db :shared-element-id shared-element-id)})

(rf/defn navigate-to-lightbox
{:events [:chat.ui/navigate-to-lightbox]}
[{:keys [db]} shared-element-id screen-params]
(let [updated-db (assoc db :shared-element-id shared-element-id)]
(reagent/next-tick #(rf/dispatch [:navigate-to :lightbox screen-params]))
{:db updated-db}))

(rf/defn exit-lightbox-signal
{:events [:chat.ui/exit-lightbox-signal]}
[{:keys [db]} value]
Expand All @@ -357,4 +365,3 @@
{:events [:chat.ui/lightbox-scale]}
[{:keys [db]} value]
{:db (assoc db :lightbox/scale value)})

12 changes: 5 additions & 7 deletions src/status_im2/contexts/chat/messages/content/album/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@
{:key (:message-id item)
:active-opacity 1
:on-long-press #(on-long-press message context)
:on-press (fn []
(rf/dispatch [:chat.ui/update-shared-element-id (:message-id item)])
(js/setTimeout #(rf/dispatch [:navigate-to :lightbox
{:messages (:album message)
:index index
:insets insets}])
100))}
:on-press #(rf/dispatch [:chat.ui/navigate-to-lightbox
(:message-id item)
{:messages (:album message)
:index index
:insets insets}])}
[fast-image/fast-image
{:style (style/image dimensions index portrait? images-count)
:source {:uri (:image (:content item))}
Expand Down
12 changes: 5 additions & 7 deletions src/status_im2/contexts/chat/messages/content/image/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@
:key message-id
:style {:margin-top (when (pos? index) 10)}
:on-long-press on-long-press
:on-press (fn []
(rf/dispatch [:chat.ui/update-shared-element-id message-id])
(js/setTimeout #(rf/dispatch [:navigate-to :lightbox
{:messages [message]
:index 0
:insets insets}])
100))}
:on-press #(rf/dispatch [:chat.ui/navigate-to-lightbox
message-id
{:messages [message]
:index 0
:insets insets}])}
(when (and (not= text "placeholder") (= index 0))
[rn/view {:style {:margin-bottom 10}} [text/text-content message context]])
[fast-image/fast-image
Expand Down

0 comments on commit ee0df86

Please # to comment.