Fork me on GitHub


(defn- create-list-view-ds 
  ([] (create-list-view-ds (fn[r1 r2] (not= r1 r2))))
   (let[DataSource (-> js/React .-ListView .-DataSource)]
     (DataSource. (clj->js {:rowHasChanged row-compare-fn})))

(defn- convert-to-array [vec]
  (let [arr #js[]]
    (doseq [x vec] (.push arr x))

(defn create-list-model 
  ([model row-compare-fn]
  (.cloneWithRows (create-list-view-ds row-compare-fn) (convert-to-array model)))
  (.cloneWithRows (create-list-view-ds) (convert-to-array model)))
(defn render-row [row-data] 
   (r/as-element [my-row row-data]) 

(defn my-list-view [list]
  (let[ds (utils/create-list-model list)]
    [list-view {:dataSource ds :renderRow render-row}])


Hi there, I just installed re-natal on W7 and when I run: re-natal init ToBuy I get this message: Leiningen is required ()which is weird as I have leiningen installed (2.5.2) and it is recognized by everything else I use. Do I need a certain path or environment variable set?


@sveri never tested it on windows so might be that something has to be changed to support it. Presense of lein is checked by executing type lein


@drapanjanas: Ah ok, what is type in that context? I don't have it installed on windows


Hm, running that one on cygwin says lein not found


I think that makes sense as I dont have it installed in "cygwin" but only in windows, whatever the difference might be


@potapenko, thanks! Now I have to find out what exactly is the difference between your code (that apparently works!) and mine. simple_smile


Spotted it! Well, the first thing is the data source should be passed to the view as :dataSource and not as :data-source. The latter doesn’t work for whatever reason. As a side note, the render row method can both be passed as :render-row or :renderRow and it works both ways. Heh. Secondly, the render-row function should return a React component and not an array. The latter would be okay if the array was later rendered by reagent, but the listview doesn’t do any kind of post-processing on the data it gets from render-row and merely tries to return that to React, which bails if it’s a plain clojure array. Thanks a ton! simple_smile