Clojurians
#cljsrn
<
2016-06-06
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

misha06:06:46

@debug, No protocol method IAssociative... is probably about db in your code.

debug06:06:30

@misha: Got that fixed, turns out db should be returned by the handler and the promise was being returned

misha06:06:33

if that fn you are returning is called by js - every argument it receives is a js thingy

debug06:06:04

@misha: Have you setup source maps?

debug06:06:32

I need some help with this, can only see JS code in Chromium

misha06:06:50

no, did nothing other than re-natal enable-source-maps.

debug06:06:18

I did that too, source maps also enabled in Chromium

debug06:06:45

Is minification necessary? Also can't see any .map files generated

misha06:06:03

I don't really look at the code in chrome, I go straight to the IDE

debug06:06:26

As a beginner, its very tough to pinpoint mistakes

misha06:06:34

I know very little about source maps atm, can't even give you guesses

debug06:06:01

Also, I'm having trouble getting things to render with-meta callbacks

misha06:06:04

I look for line numbers in stack traces and go to IDE )

debug06:06:27

Clojurescript line numbers? All I see is JS exceptions and whatnot

misha06:06:54

shake the device simulator -> enable browser debugging it'll print exceptions in the console. some will have only js code "lines", some will have cljs ones

debug06:06:39

I've seen cljs ones with Yellow boxes though, but they're very rare, and when they do show up, very helpful

debug06:06:25

The tools seem so immature though from the react-native side, they don't even support Chromium had to soft link to fake Google Chrome

misha06:06:46

I think you'll see cljs references for everything that can be caught with lein cljsbuld once. other stuff goes through react bridge and native code at some point before crashing, and expecting cljs source maps working there is a bit optimistic, I think

debug06:06:24

Is this valid? (defn scrollable-root [] (fn [] [view {:style {:flex 1}}])) Because nothing renders when referencing it this way [scrollable-root ....]

misha07:06:55

(defn scrollable-root []
  [view {:style {:flex 1}}])

misha07:06:42

not sure if you need extra (fn [] ...) around [view ...]

debug07:06:41

I tried that one too at first, nothing happed

debug07:06:58

(defn scrollable-root [] [view {:style {:flex 1}}])
(def root (with-meta scrollable-root {:component-did-mount #(dispatch [:load-data])}))

(def get-row #(reagent.core/as-element [text {:style {:height 48 :textAlignVertical "center"}} (str "Index: " %)]))

(defn app-root []
  (let [data (subscribe [:get-data])]
    (fn []
      (js/console.warn @data)
      [root
       [toolbar  {:title "FutureApp" :style {:height 56 :flexDirection "column"}}]
       [listview {:style {:paddingLeft 8 :paddingRight 8 :flex 1}
                   :dataSource (.cloneWithRows (datasource. #js {:rowHasChanged not=}) (clj->js @data))
                   :renderRow get-row}]])))

debug07:06:28

Toying around with this little piece since days

debug07:06:01

Got the list working almost nicely (hit a bug that's been posted above), but now I want to use the lifecycle callback, and I setup things this way, but nothing renders

debug07:06:25

Now, trying Form-3 components..

debug08:06:38

Nope, doesn't render

debug08:06:39

(defn scrollable-root [& content] [view {:style {:flex 1 :height 500}} content])
(defn root [& content] (reagent.core/create-class {:component-did-mount #(dispatch [:load-data]) :reagent-render #(scrollable-root content)}))
Now works!