Skip to content

Commit 8aa875e

Browse files
committed
fix review
1 parent 6e2680d commit 8aa875e

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

src/status_im/ui/components/fast_image.cljs

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,20 @@
77
[react/view {:style (merge style {:flex 1 :justify-content :center :align-items :center})}
88
child])
99

10-
(defn fast-image [props]
10+
(defn fast-image [_]
1111
(let [loaded? (reagent/atom false)
1212
error? (reagent/atom false)]
13-
(fn []
13+
(fn [props]
1414
[react/fast-image-class (merge
15-
{:on-error #(reset! error? true)
16-
:on-load #(reset! loaded? true)}
17-
props)
15+
props
16+
{:on-error (fn [e]
17+
(when-let [on-error (:on-error props)]
18+
(on-error e))
19+
(reset! error? true))
20+
:on-load (fn [e]
21+
(when-let [on-load (:on-load props)]
22+
(on-load e))
23+
(reset! loaded? true))})
1824
(when (or @error? (not @loaded?))
1925
[placeholder (:style props)
2026
(if @error?

src/status_im/ui/screens/chat/message/message.cljs

+8
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,16 @@
375375
:disabled in-popover?}
376376
[react/view {:style (style/image-message style-opts)
377377
:accessibility-label :image-message}
378+
(when (or (:error @dimensions) (not (:loaded @dimensions)))
379+
[react/view
380+
(merge (dissoc style-opts :opacity)
381+
{:flex 1 :align-items :center :justify-content :center :position :absolute})
382+
(if (:error @dimensions)
383+
[icons/icon :main-icons/cancel]
384+
[react/activity-indicator {:animating true}])])
378385
[fast-image/fast-image {:style (dissoc style-opts :outgoing)
379386
:on-load (image-set-size dimensions)
387+
:on-error #(swap! dimensions assoc :error true)
380388
:source {:uri uri}}]
381389
[react/view {:style (style/image-message-border style-opts)}]]]]))))
382390

src/status_im/ui/screens/chat/styles/message/message.cljs

+2-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@
400400

401401
(defn image-message-border [opts]
402402
(merge (image-message opts)
403-
{:border-width 1
403+
{:opacity (:opacity opts)
404+
:border-width 1
404405
:top 0
405406
:left 0
406407
:position :absolute

0 commit comments

Comments
 (0)