Using a React Native ListView with om.next
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(list-view | |
{:dataSource (clone-with-rows | |
data-source | |
(clj->js | |
(mapv #(assoc % :omcljs$meta (pr-str (meta %))) | |
objects))) | |
:renderRow (fn objects-render-r-row [row section-id row-id] | |
(let [row (j->c row) | |
m (:omcljs$meta row) | |
m (if m (reader/read-string m)) | |
row (with-meta (dissoc row :omcljs$meta) m)] | |
(with-om-vars this | |
(objects-row row)))) | |
:style (:list styles)}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro with-om-vars [component & body] | |
;; these should match the 'render case in reshape-map | |
`(let [this# ~component | |
reconciler# (or om.next/*reconciler* | |
(om.next/get-reconciler this#)) | |
depth# (or om.next/*depth* (inc (om.next/depth this#))) | |
shared# (or om.next/*shared* (om/shared this#)) | |
instrument# (or om.next/*instrument* (om/instrument this#)) | |
parent# (or om.next/*parent* this#)] | |
(binding [om.next/*reconciler* reconciler# | |
om.next/*depth* depth# | |
om.next/*shared* shared# | |
om.next/*instrument* instrument# | |
om.next/*parent* this#] | |
~@body))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment