File tree 3 files changed +21
-6
lines changed
3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 7
7
[react/view {:style (merge style {:flex 1 :justify-content :center :align-items :center })}
8
8
child])
9
9
10
- (defn fast-image [props ]
10
+ (defn fast-image [_ ]
11
11
(let [loaded? (reagent/atom false )
12
12
error? (reagent/atom false )]
13
- (fn []
13
+ (fn [props ]
14
14
[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 ))})
18
24
(when (or @error? (not @loaded?))
19
25
[placeholder (:style props)
20
26
(if @error?
Original file line number Diff line number Diff line change 375
375
:disabled in-popover?}
376
376
[react/view {:style (style/image-message style-opts)
377
377
: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 }])])
378
385
[fast-image/fast-image {:style (dissoc style-opts :outgoing )
379
386
:on-load (image-set-size dimensions)
387
+ :on-error #(swap! dimensions assoc :error true )
380
388
:source {:uri uri}}]
381
389
[react/view {:style (style/image-message-border style-opts)}]]]]))))
382
390
Original file line number Diff line number Diff line change 400
400
401
401
(defn image-message-border [opts]
402
402
(merge (image-message opts)
403
- {:border-width 1
403
+ {:opacity (:opacity opts)
404
+ :border-width 1
404
405
:top 0
405
406
:left 0
406
407
:position :absolute
You can’t perform that action at this time.
0 commit comments