File tree 1 file changed +10
-1
lines changed
src/status_im2/contexts/chat/messages/content/image
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 8
8
[utils.re-frame :as rf]
9
9
[utils.url :as url]))
10
10
11
+ ; ; these constants are used when there is no width or height defined for a specific image
12
+ (def ^:const fallback-image-width 1000 )
13
+ (def ^:const fallback-image-height 1000 )
14
+
11
15
(defn calculate-dimensions
12
16
[width height max-container-width max-container-height]
13
17
(let [max-width (if (> width height) max-container-width (* 1.5 constants/image-size))
14
18
max-height (if (> width height) max-container-height (* 2 constants/image-size))]
15
19
{:width (min width max-width) :height (min height max-height)}))
16
20
17
21
(defn image-message
18
- [index {:keys [content image-width image-height message-id] :as message} {:keys [on-long-press]}
22
+ [index
23
+ {:keys [content image-width image-height message-id]
24
+ :as message
25
+ :or {image-width fallback-image-width
26
+ image-height fallback-image-height}}
27
+ {:keys [on-long-press]}
19
28
message-container-data]
20
29
(let [insets (safe-area/get-insets )
21
30
{:keys [window-width padding-left padding-right avatar-container-width
You can’t perform that action at this time.
0 commit comments