Fork me on GitHub
#reagent
<
2016-09-08
>
Jon02:09:57

I got a Wiki page for Respo's SSR solution here https://github.com/Respo/respo/wiki/SSR I think this feature is challenging for React.js based solutions since React.js does not expose virtual DOM to developers. (For people who don't know Respo, it's a pure ClojureScript implementation of virtual DOM library.)

brolund06:09:57

I have a question about "named children", like in https://github.com/andyfenelon/react-native-UIKit#grid. How do I add the subcomponents to that, in this case the headerContent and the footerContent?

martinklepsch11:09:28

@brolund If I understand correctly these are all passed as props so you just need to pass a javascript hashmap to the component

martinklepsch11:09:04

[Grid #js {:headerContent ... :footerContent ...}]

martinklepsch11:09:50

that [Grid ... constructor thing is probably wrong, I can never remember how to use ordinary React components in Reagent

brolund15:09:17

@martinklepsch: Thanks for your answer. I'm trying some variations on this, to no avail:

(def ReactNativeUIKit (js/require "react-native-uikit"))
(def grid (.-Grid ReactNativeUIKit))
...
       [grid #js {
              :images [{:id 0, :src "file:///data/user/0/com.adomain/cache/IMG_20160906_145802-1721123790.jpg"}]
              :headerContent (fn [] [view  [text "Header text"]])
              :footerContent (fn [] [view  [text "Footer text"]])
              }
        
        ]

Any pointers to where I go wrong are welcome. A more detailed explanation of your ... even more so. 😉

martinklepsch15:09:10

I think this (def grid (.-Grid ReactNativeUIKit)) doesn't work just like that but I also don't remember how to do it

brolund15:09:32

I've also tried

(def grid (r/adapt-react-class (.-Grid ReactNativeUIKit)))
for the declaration, same results i.e. nothing.

martinklepsch15:09:12

try r/as-element as well

martinklepsch15:09:59

@brolund unfortunately I don't have any specific suggestions beyond that but probably someone else will chime in later

martinklepsch15:09:30

Tried this search for examples but to much react native reloader stuff to see through the woods https://github.com/search?q=as-element+extension%3Acljs&amp;type=Code&amp;utf8=%E2%9C%93

brolund15:09:32

Thanks. Yeah, I've google quite a bit, finding bits and pieces, but not understanding the whole picture just yet. 🙂

brolund15:09:52

@martinklepsch:

(def ReactNativeUIKit (js/require "react-native-uikit"))
(def grid (.-Grid ReactNativeUIKit))
[grid #js {
                  :images (js/Array #js{:id 0 :src ""})
                  :headerContent (r/as-element [view  [text "Header content"]])
                  :footerContent (r/as-element [view  [text "Footer content"]])
                  :itemsPerRow 4
                  :spacing 1
                  }]
...got the header and footer working. Yay! 🙂 Now I just cannot get the actual image grid working... 😛

brolund16:09:17

I.e the image don't show.

brolund16:09:37

Yeah 🙂 But now I really don't understand what the problem is. 😉 Reading the code the image array should be just fine, but nothing shows...

martinklepsch16:09:33

try #js [ #js {} ]