Skip to content

Commit

Permalink
Fix: logo and community image banner not showing correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-mut committed Mar 14, 2023
1 parent e301359 commit ea0a6a4
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 43 deletions.
7 changes: 3 additions & 4 deletions src/quo2/components/community/community_card_view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
[rn/view (style/community-cover-container 60)
[rn/image
{:source cover
:style
{:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
:style {:flex 1
:border-top-right-radius 20
:border-top-left-radius 20}}]]
[rn/view (style/card-view-content-container 12)
[rn/view (style/card-view-chat-icon 48)
[icon/community-icon {:images images} 48]]
Expand Down
8 changes: 4 additions & 4 deletions src/status_im2/common/scroll_page/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@


(defn display-picture
[scroll-height cover]
[scroll-height logo]
(let [input-range (if platform/ios? [-67 10] [0 150])
y (reanimated/use-shared-value scroll-height)
animation (reanimated/interpolate y
Expand All @@ -104,7 +104,7 @@
[reanimated/view
{:style (style/display-picture-container animation)}
[rn/image
{:source cover
{:source logo
:style style/display-picture}]]))

(defn scroll-page
Expand Down Expand Up @@ -141,6 +141,6 @@
{:flex 1
:border-radius (diff-with-max-min @scroll-height 16 0)
:background-color background-color}
(when cover-image
[:f> display-picture @scroll-height cover-image])
(when logo
[:f> display-picture @scroll-height logo])
children])]}]])))
8 changes: 4 additions & 4 deletions src/status_im2/contexts/communities/discover/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

(def featured-list-container
{:flex-direction :row
:overflow :hidden})
:overflow :hidden
:margin-right 20})

(def flat-list-container
{:padding-bottom 24
:margin-left 20
:padding-right 20})
{:padding-bottom 24
:padding-horizontal 20})

(def other-communities-container
{:flex 1
Expand Down
44 changes: 13 additions & 31 deletions src/status_im2/contexts/communities/discover/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[reagent.core :as reagent]
[status-im2.common.resources :as resources]
[status-im2.contexts.communities.menus.community-options.view :as options]
[status-im.ui.screens.communities.community :as community]
[status-im.ui.components.react :as react]
[react-native.platform :as platform]
[status-im2.common.scroll-page.view :as scroll-page]
Expand All @@ -26,7 +25,7 @@
[community-item _ _ {:keys [width view-type]}]
(let [item (merge community-item
(get mock-community-item-data :data))
cover {:uri (get-in (:images item) [:banner :uri])}]
cover {:uri (get-in (:images community-item) [:banner :uri])}]
(if (= view-type :card-view)
[quo/community-card-view-item (assoc item :width width :cover cover)
#(rf/dispatch [:navigate-to :community-overview (:id item)])]
Expand Down Expand Up @@ -89,16 +88,15 @@
:label (i18n/label :t/gated)
:accessibility-label :gated-communities-tab}]}]])


(defn featured-list
[communities view-type]
(let [view-size (reagent/atom 0)]
(fn []
[rn/view
{:style style/featured-list-container
:on-layout #(swap! view-size
(fn []
(- (oops/oget % "nativeEvent.layout.width") 20)))}
(fn []
(- (oops/oget % "nativeEvent.layout.width") 20)))}
(when-not (= @view-size 0)
[rn/flat-list
{:key-fn :id
Expand Down Expand Up @@ -127,32 +125,16 @@
(defn other-communities-list
[{:keys [communities communities-ids view-type]}]
[rn/view {:style style/other-communities-container}
(map-indexed
(fn [inner-index item]
(let [community-id (when communities-ids item)
community (if communities
item
[rf/sub [:communities/home-item community-id]])]
[rn/view
{:key (str inner-index (:id community))
:margin-bottom 16}
(if (= view-type :card-view)
[quo/community-card-view-item
(merge community
(get mock-community-item-data :data))
#(rf/dispatch [:navigate-to :community-overview (:id community)])]
[quo/communities-list-view-item
{:on-press (fn []
(rf/dispatch [:communities/load-category-states (:id community)])
(rf/dispatch [:dismiss-keyboard])
(rf/dispatch [:navigate-to :community (:id community)]))
:on-long-press #(rf/dispatch [:bottom-sheet/show-sheet
{:content (fn []
;; TODO implement with quo2
[community/community-actions community])}])}
(merge community
(get mock-community-item-data :data))])]))
(if communities communities communities-ids))])
[rn/flat-list
{:key-fn :id
:keyboard-should-persist-taps :always
:shows-horizontal-scroll-indicator false
:separator [rn/view {:height 16}]
:data (if communities
communities
communities-ids)
:render-fn community-list-item
:render-data {:view-type view-type}}]])

(defn communities-lists
[selected-tab view-type]
Expand Down

0 comments on commit ea0a6a4

Please sign in to comment.