Fork me on GitHub
#cljsrn
<
2016-04-01
>
jessica07:04:23

Has anyone been successful with using sente on an actual device? The source code attempts to call enc/get-window-location, but I’m getting this error undefined is not an object (evaluating ‘taoensso.encore.get_window_location.call). It will run fine when debugging via the local server running; but once I try to bundle the app onto the device, it breaks. The call on client side looks something like:

(sente/make-channel-socket! "/chsk"
                                    {:type :ws
                                     :host “"})]

stepugnetti14:04:39

Hi! Has anybody tried to use https://github.com/aksonov/react-native-router-flux with Reagent? The router component throws an error: component property is not set for key=root, but I don’t understand why. I mean, I gave a look at the source and I fund the relevant assertion, but I think I have correctly set the property that causes the assertion fail...

pesterhazy15:04:43

@stepugnetti: I don't know about your problem (sorry!) but I'd love to hear how you like it in relation to reagent, once you get it working

pesterhazy15:04:14

in general I don't see why a react component wouldn't work with reagent

pesterhazy15:04:33

could you share the code you use to call the router?

vikeri15:04:51

@stepugnetti: I’m looking at implementing NavigationExperimental instead, it seems to map really well to re-frame if you would use that: https://github.com/ericvicenti/navigation-rfc/blob/master/Docs/Navigation.md

stepugnetti15:04:30

@vikeri: Cool! However, I’m trying to keep as close as possible to https://github.com/reactjs/react-router/tree/latest, and aksonov repo looked promising.

vikeri15:04:36

Okok! NavigationExperimental is being integrated into the main ReactNative branch repo now though fyi

stepugnetti15:04:08

@pesterhazy: I’m quite happy with Reagent for the moment, both for React and React Native. To use the router I first had to import the js library into cljs as a my-own.react-native-router namespace. Then, more or less:

(require ‘my-own.react-native-router)
(def router* (adapt-react-class (.-Router js/ReactNativeRouter)))
(defn router
  [& [opts & children :as args]]
  (into [router* opts] children))
I tried adding several properties into opts, like :key and :ref (to inspect what is going on), but I could not get it working up to now. @vikeri: Thanks! I’ll keep it in mind, in case I fail with this approach. I am developing the same app for the web and ios/android, so keeping the APIs of my external libs as close as possible from one side to the other is rather important...

vikeri15:04:53

@stepugnetti: Alright, that makes sense then.

misha19:04:48

greetings, gentlemen, just a sanity check: Im I doing "cljs-react-native" right?

(ns ...
  (:require-macros
   [natal-shell.components :refer [text list-view]]
   [natal-shell.data-source :refer [data-source clone-with-rows]]))

(rum/defc my-view []
  (let [ds (-> (data-source {:rowHasChanged #(not= % %2)})
             (clone-with-rows ["aaa" "bbb" "ccc"]))]
    (list-view
      {:dataSource ds
       :renderRow #(text {} %)})))
does anything seem odd to you (besides the ds init is in render instead of init)?