Fork me on GitHub
#cljsrn
<
2017-11-19
>
stask13:11:21

@manu i used reagent.core/as-component, like this:

(def refresh-control (adapt-react-class (.-RefreshControl ReactNative)))
...
(defn refresh [sub event]
  (let [refreshing? (subscribe [sub])]
    (fn [sub event]
      [refresh-control {:refreshing @refreshing?
                        :on-refresh #(dispatch [event])}])))
...
(defn headings-panel []
  (let [headings (subscribe [:last-headings])]
    (fn []
      [scroll-view {:refresh-control (r/as-component [refresh
                                                      :refreshing-headings?
                                                      :refresh-last-headings])}
       (if (seq @headings)
         (for [[i heading] (map-indexed vector (take 30 @headings))]
           ^{:key i} [text {:style (:entry styles)}
                      (humanize-heading heading)])
         [text {:style {:text-align :center}}
          "no headings"])])))

seantempesta18:11:23

Just updated the expo-cljs-template to v22. If you’ve been dying to try Clojurescript + Expo, head over here for the latest and greatest. Many thanks to @drapanjanas as I’ve liberally borrowed from his project (especially w/r/t the recent Figwheel upgrades). 🙂 https://github.com/seantempesta/expo-cljs-template