Discover: replace carousel with horizontal flat list

This commit is contained in:
Oskar Thorén 2017-10-10 11:15:27 +02:00 committed by Roman Volosovskyi
parent 1d2a7e2f6e
commit e732f5559c
1 changed files with 6 additions and 11 deletions

View File

@ -5,12 +5,10 @@
[status-im.components.react :as react] [status-im.components.react :as react]
[status-im.components.list.views :as list] [status-im.components.list.views :as list]
[status-im.components.chat-icon.screen :as chat-icon] [status-im.components.chat-icon.screen :as chat-icon]
[status-im.components.carousel.carousel :as carousel]
[status-im.ui.screens.discover.components.views :as discover-components] [status-im.ui.screens.discover.components.views :as discover-components]
[status-im.ui.screens.discover.styles :as styles] [status-im.ui.screens.discover.styles :as styles]
[status-im.i18n :as i18n] [status-im.i18n :as i18n]
[status-im.components.toolbar-new.view :as toolbar] [status-im.components.toolbar-new.view :as toolbar]))
[taoensso.timbre :as log]))
(defn navigate-to-dapp [dapp] (defn navigate-to-dapp [dapp]
(do (re-frame/dispatch [:set :discover-current-dapp dapp]) (do (re-frame/dispatch [:set :discover-current-dapp dapp])
@ -40,14 +38,11 @@
:t/all :t/all
#(re-frame/dispatch [:navigate-to :discover-all-dapps])] #(re-frame/dispatch [:navigate-to :discover-all-dapps])]
(if (seq dapps) (if (seq dapps)
;; TODO(oskarth): Make this carousel show more dapps at a time ;; TODO(oskarth): Too wide margins bug
[carousel/carousel {:page-style styles/carousel-page-style [list/flat-list {:data (vals dapps)
:count (count dapps)} :render-fn render-dapp
(for [[_ dapp] dapps] :horizontal true
^{:key (str (:name dapp))} :content-container-style styles/all-dapps-flat-list}]
[react/touchable-highlight {:on-press #(navigate-to-dapp dapp)}
[react/view styles/dapp-preview-content
[dapp-item dapp]]])]
[react/text (i18n/label :t/none)])]) [react/text (i18n/label :t/none)])])
(defview main [] (defview main []