Skip to content

Commit

Permalink
Fix images displaying for desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
vkjr committed Sep 16, 2019
1 parent 7d4041c commit 69dc1f0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
3 changes: 2 additions & 1 deletion clj-rn.conf.edn
Expand Up @@ -81,7 +81,8 @@

;; Resoures
:resource-dirs ["resources/images"
"resources/icons"]
"resources/icons"
"desktop/resources"]

:figwheel-options {:nrepl-port 7888
:nrepl-middleware ["cider.nrepl/cider-middleware"
Expand Down
23 changes: 15 additions & 8 deletions src/status_im/ui/components/icons/vector_icons.cljs
@@ -1,6 +1,8 @@
(ns status-im.ui.components.icons.vector-icons
(:require [status-im.ui.components.react :as react]
[status-im.ui.components.colors :as colors])
[status-im.ui.components.colors :as colors]
[status-im.utils.platform :as platform]
[clojure.string :as string])
(:refer-clojure :exclude [use]))

(defn- match-color [color]
Expand All @@ -19,6 +21,11 @@
:else
colors/black))

(defn icon-source [name]
(if platform/desktop?
{:source (js/require (str "./desktop/resources/" (string/replace (clojure.core/name name) "-" "_") ".png"))}
{:source {:uri (keyword (clojure.core/name name))}}))

(defn icon
([name] (icon name nil))
([name {:keys [color resize-mode container-style
Expand All @@ -31,15 +38,15 @@
{:width (or width 24)
:height (or height 24)})
:accessibility-label accessibility-label}
[react/image {:source {:uri (keyword (clojure.core/name name))}
:style (cond-> {:width (or width 24)
:height (or height 24)}
[react/image (merge {:style (cond-> {:width (or width 24)
:height (or height 24)}

resize-mode
(assoc :resize-mode resize-mode)
resize-mode
(assoc :resize-mode resize-mode)

color
(assoc :tint-color (match-color color)))}]]))
color
(assoc :tint-color (match-color color)))}
(icon-source name))]]))

(defn tiny-icon
([name] (tiny-icon name {}))
Expand Down
10 changes: 6 additions & 4 deletions src/status_im/ui/screens/home/styles.cljs
Expand Up @@ -15,10 +15,12 @@
{:flex-shrink 1})

(def last-message-text
{:flex 1
:align-self :stretch
:line-height 22
:color colors/gray})
(merge {:flex 1
:align-self :stretch
:line-height 22
:color colors/gray}
(when platform/desktop?
{:max-height 20})))

(def search-input-height 56)

Expand Down

0 comments on commit 69dc1f0

Please sign in to comment.