This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-14
Channels
- # beginners (19)
- # boot (28)
- # cider (1)
- # cljs-dev (12)
- # cljsrn (1)
- # clojure (246)
- # clojure-belgium (4)
- # clojure-berlin (1)
- # clojure-france (4)
- # clojure-italy (7)
- # clojure-russia (11)
- # clojure-serbia (3)
- # clojure-spec (5)
- # clojurescript (106)
- # cursive (4)
- # datomic (7)
- # emacs (1)
- # jobs (6)
- # leiningen (3)
- # luminus (1)
- # lumo (11)
- # off-topic (1)
- # om (7)
- # onyx (1)
- # pedestal (6)
- # re-frame (16)
- # reagent (4)
- # rum (3)
- # spacemacs (1)
- # unrepl (1)
- # untangled (5)
- # vim (1)
Hey all, I'm trying to get the scrollTo...
-methods of RN's https://facebook.github.io/react-native/docs/virtualizedlist.html (or flatlist) to work. I tried with rum
, without success, so I switched to reagent
, without any luck so far. There are no errors, but the scrolling just doesn't happen. Here's some code:
;; component to render each item
(defn list-item
[item]
...)
;; just using a new project
(defn app-root []
(r/create-class ;; trying to 'translate' javascript to reagent ()
{:component-did-mount
(fn[this]
(let [flatlist (-> (.. this -refs)
js->clj
(get "qa-list"))]
(println flatlist) ;; this gives '#object[FlatList [object Object]]'
(.scrollToEnd flatlist) ;; doesn't work, as any other .scrollTo-method (no error, but no scrolling either)
))
:reagent-render
(let [greeting (subscribe [:get-greeting])]
(fn []
[view {:style {:flex-direction "column" :margin 40 :align-items "center"}}
[text {:style {:font-size 30 :font-weight "100" :margin-bottom 20 :text-align "center"}} @greeting]
[virt-list {:data all
:keyExtractor (fn [item idx] (str "list-item::" idx))
:ref "list-list"
:renderItem (fn [item] (r/as-element (list-item item)))}]]))}))
Anyone got the scrollTo
-methods of running yet in reagent/cljsrn?Oh yeah: (def virt-list (r/adapt-react-class (.-FlatList ReactNative)))
and (def all [...])
(I tried both VirtualizedList
and FlatList
)
OK, I may have found the problem: http://stackoverflow.com/questions/33208477/react-native-android-scrollview-scrollto-not-working