This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-06
Channels
- # beginners (90)
- # boot (83)
- # cider (39)
- # clara (4)
- # cljs-dev (124)
- # cljsrn (10)
- # clojure (208)
- # clojure-boston (1)
- # clojure-italy (13)
- # clojure-nlp (3)
- # clojure-russia (34)
- # clojure-spec (63)
- # clojure-uk (101)
- # clojurescript (65)
- # community-development (13)
- # copenhagen-clojurians (1)
- # core-async (1)
- # cursive (24)
- # datascript (1)
- # datomic (65)
- # emacs (20)
- # graphql (20)
- # hoplon (21)
- # instaparse (18)
- # jobs (5)
- # jobs-discuss (2)
- # leiningen (8)
- # luminus (32)
- # midje (1)
- # mount (3)
- # off-topic (18)
- # om (10)
- # parinfer (6)
- # pedestal (2)
- # planck (2)
- # precept (22)
- # protorepl (7)
- # re-frame (45)
- # reagent (9)
- # ring (1)
- # ring-swagger (4)
- # rum (2)
- # spacemacs (5)
- # sql (2)
- # unrepl (13)
- # untangled (8)
- # yada (5)
a-ha, today I definitely have a question: I am trying to use nativebase
components… in general they work great with my little cljsrn project, but I can’t get the thumbnail
component to work. Does anybody here have experience with nativebase over cljsrn?
the hiccup looks something like this:
[list-item {:key (:id contact) :avatar true}
[left {} [thumbnail {:source {:uri (:avatar contact)}}]]
[body {} [text (:name contact)] [text {:note true} (:snip contact)]]]
and the contact
data looks something like: {:id 12 :name "White Rabbit" :avatar "./images/rabbit.png" :snip "it's late..."}
to answer my own question ->
(let [avatar (js/require (:avatar contact))]
[list-item {:key (:id contact) :avatar true}
[left {} [thumbnail {:source avatar}]]
[body {} [text (:name contact)] [text {:note true} (:snip contact)]]])
Can anyone help me understand how to translate something from JS->CLJS, namely: https://github.com/deanmcpherson/react-native-sortable-listview/blob/master/example.js
class MyComponent extends React.Component {
render() {
return (
<SortableListView
style={{ flex: 1 }}
data={data}
order={order}
onRowMoved={e => {
order.splice(, 0, order.splice(e.from, 1)[0])
this.forceUpdate()
}}
renderRow={row => <RowComponent data={row} />}
/>
)
}
}
That renderRow
bit — I’m not sure how to use reagent to pass in the row component.I’ve tried [sortable-listview {:data ... :order ... :renderRow (r/as-component [text "hi"])}]
for example
(among a whole bunch of other possibilities)
Ah, got it: :renderRow (fn [row] (r/as-element [text "hi"]))
(or obviously any other way of using as-element
and passing the row data in)