Skip to content

Commit

Permalink
horizontal scrollable positioned list
Browse files Browse the repository at this point in the history
  • Loading branch information
amjil committed Feb 2, 2023
1 parent f4dff6a commit 52b9472
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/anabapa_list/data.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -527,5 +527,4 @@
(map (fn [[k v]] (map-indexed (fn [idx itm] {:name itm :idx idx :tag (str (first itm))}) v)))
(flatten)
(sort-by (juxt :tag :name))
(map-indexed (fn [idx itm] (assoc itm :index idx)))
))
(map-indexed (fn [idx itm] (assoc itm :index idx)))))
17 changes: 9 additions & 8 deletions src/anabapa_list/indexed_list.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
(let [item (nth items i)
sus-height 40]
(if (= 0 (:idx item))
(m/Column
(m/Row
.mainAxisSize (.min m/MainAxisSize)
.children
[(m/Container
.height sus-height
.width (-> m/MediaQuery (.of ctx) .-size .-width)
.padding (.only m/EdgeInsets .left 16)
.width sus-height
.height (-> m/MediaQuery (.of ctx) .-size .-height)
.padding (.only m/EdgeInsets .top 16)
.color (m/Color 0xFFF3F4F5)
.alignment (.centerLeft m/Alignment)
.alignment (.topCenter m/Alignment)
.child (m/Text (:tag item)
.softWrap false
.style (m/TextStyle .fontSize 14
.color (m/Color 0xFF666666))))
(m/ListTile .title (m/Text (:name item)))])
(m/ListTile .title (m/Text (:name item))))))
(mgl/MongolListTile .title (mgl/MongolText (:name item)))])
(mgl/MongolListTile .title (mgl/MongolText (:name item))))))

(defn positions-changed
[^scroll-list/ItemPositionsListener
Expand Down Expand Up @@ -72,12 +72,13 @@
:items items
:state state}
(m/Container
.width (-> m/MediaQuery (.of ctx) .-size .-width))
.height (-> m/MediaQuery (.of ctx) .-size .-height))
.child
(m/Stack
.children
[(.builder
scroll-list/ScrollablePositionedList
.scrollDirection (.horizontal m/Axis)
.itemCount (count items)
.itemBuilder
(fn [context index]
Expand Down

0 comments on commit 52b9472

Please sign in to comment.