This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-05-19
Channels
- # ai (3)
- # aws (1)
- # beginners (94)
- # boot (26)
- # cider (3)
- # cljs-dev (99)
- # cljsrn (86)
- # clojure (263)
- # clojure-dusseldorf (4)
- # clojure-greece (22)
- # clojure-italy (2)
- # clojure-quebec (1)
- # clojure-russia (12)
- # clojure-spec (71)
- # clojure-uk (123)
- # clojurescript (92)
- # core-async (4)
- # cursive (13)
- # data-science (2)
- # datomic (123)
- # docker (2)
- # emacs (15)
- # events (1)
- # graphql (2)
- # hoplon (71)
- # jobs-discuss (7)
- # lumo (5)
- # off-topic (12)
- # om (6)
- # onyx (97)
- # other-languages (4)
- # overtone (2)
- # pedestal (1)
- # re-frame (20)
- # reagent (33)
- # remote-jobs (1)
- # ring-swagger (1)
- # rum (5)
- # slack-help (6)
- # uncomplicate (1)
- # unrepl (33)
- # untangled (48)
- # vim (23)
- # yada (21)
I've updated my https://github.com/amorokh/om-navigate example so that the om-next context (reconciler, depth, parent etc) is no longer lost for components
@pesterhazy Well as you know I'm trying to see if hot reload could work better than figwheel. But after some tests I concluded that the hot reload works by diffing files not code. Therefore I had several problems trying to play it together with cljsbuild auto since I get a single file out (:simple)
So I thought that if I could make the react native packager recognize goog.require statements then it could work. That's when I stumbled upon your patch. But I saw it in the issue description not on a pr. Which made me think that it didn't work or that it was dropped :(
Since that could benefit the whole cljs ecosystem would you consider making it part of react native itself? Not only as a patch to boot :) ?
@vikeri: I’ve had good luck just increasing the timeout. Edit: ./node_modules/react-native/packager//src/JSTransformer/index.js and add a couple zeros to const TRANSFORM_TIMEOUT_INTERVAL = 30100000;
They seemed to fix the out of memory errors, so it just takes forever to parse a large cljs
file. It’s taking me around 12 minutes every time I package my app.
We really need to figure out a way to bypass it. If we had a way to only run the packager on all of the (js/requires
and then append the clojurescript file to the output it would work, right? Because the cljs compiler is doing all the same stuff (ie minifying, converting ES6 javascript to normal js, etc).
@seantempesta Ok interesting, for now I reverted back to not using advanced compilation and compiling all files separately. Yeah the issue is that I use things like promises and other ES6 stuff in my cljs code. But other than that all code generated by the Closure Compiler is good ol ES3, so very frustrating that Babel spend insane amounts of time analyzing it…
@carocad The fb devs themselves aren’t too excited about the built in hmr so maybe not worth spending a lot of effort getting that working: https://github.com/callstack-io/haul/issues/2#issuecomment-289016826
@vikeri thanks a lot. That explains the behavior I was having when hot reloading my app. It displayed "hot reload" I the screen but no update. What a shame, but thanks for the heads up
On another topic, has anyone tried to compile cljs code with nodejs target? I have tried it several times but react native always fails bundling the app. I thought it would be a better fit for rn apps ...
@carocad I also tried it but the issue I ran into is the lack of modules like path
, fs
etc. If you shim them you might have better luck compiling it.
Jummm I thought rn was smart enough to provide a shim for those, like browserify does. But do I need to do that even if I don't require those modules? Or is it something that cljs is doing by itself on the background?
You have this: https://github.com/mvayngrib/rn-nodeify/
Greetings all. I am quite interested in react native clojurescript (re-natal) and I was wondering whether from your experience there is anything related to performance I should know upfront ? thank you.
@carocad I see thanks for the explanation
I did start the process of submitting a patch: https://github.com/facebook/react-native/issues/9084
but the response was so slow that I ended up being discouraged
I agree that this should be upstreamed
I will say that just patching RN works surprisingly well
@jouerose I did a one week spike to get an android version of an ios app started
that was almost a year ago
my general impression was that in the emulator things were slower than in the ios simulator
"dev" mode slowed things down tremendously (it doesn't on iOS) so turning that off improved performance a lot
but I didn't get much farther for lack of time
@pesterhazy thanks for your input.
@pesterhazy do you know if there is any way in babel or the react native package to stop it from using their plugins/loaders in a certain directory?
yup. I agree.
seems stupid to run all their babel transforms on CLJS code since that already is ES3 and doesn't need any of them
yeah!
if there is anybody who as react-native android experience please let us know what you think we should know upfront. thanks
up front: beware of gradle and of the build tools for android. They are painful to get right and you need very specific tool-versions. One slight change in the version and it all crashes
I have had some slow performance on dev (with figwheel) but I am not sure if it is because of the code or because my phone is just too old. Whenever I compile with lein prod-build (I am using re-natal) then the perf its quite good
@jouerose The end result is very pleasing and very performant. The problem is the infrastructure around it. RN+CLJS is fairly new and everyone agrees we haven’t fully nailed the infrastructure parts of it yet. And it’s hard to do it since RN itself has not fully settled on that part, some major changes seems to hit the packager soon for example. So be prepared to spend some time on your setup.
Also, on Android check beforehand if people have issues with your particular model. I taught a React Native class at a university and a couple of students had problems using their (Sony Experia) phones for development.
@jouerose Yeah, but don’t hold it against me if that’s not your experience 😅 We use React Navigation and Realm for navigation and storage respectively.
@vikeri RN Navigation and Realm. good to know. thanks. and yes I will hold it against you, I will send the night king and if not available mortal kombat's Sub Zero will do. 🙂
Haha, not RN Navigation, React Navigation: https://reactnavigation.org/
I checked out the quick hack that you published on github but couldnt get my head around it 😞
@carocad Yeah I’m using my own, but it’s not ideal when it comes to the tabs. So if seantempesta solved that I might migrate
@seantempesta to be honest I havent throughly checked your library but could you please give us a heads up on that 🙂 ?
@thheller no I gave up pretty quickly trying to disable babel transforms the last time, but that was a while ago - maybe things have changed for the better
the RN packager will soon be extracted as a separate repo, maybe that will give its issues more visibility
but we can't be the only ones suffering from that issue no? seems like every compile-to-JS language shouldn't need those presets
i am starting cljsrn and wondering: i see the definitions of components at the beginning of the file. is it not something that could be done automatically ? any idea what has prevented this so far ?
@thheller packager related issues I've raised in the past were pretty much ignored
@jouerose you mean write a macro like (import-react-native '[text view touchable-highlight])
?
@pesterhazy exact!
yup that would be a possibilty 🙂
I think it's just not enough of a pain for people yet
also adding macros has a cost - additional complexity, plus you can't easily grep for the definition of TouchableHighlight or whatever
not saying this is not a good idea, but these are reasons why I haven't used a macro for this yet
@seantempesta In your navigation library, did you get tabs to work well with re-frame? I.e. overriding the tab state with the re-frame state?
@jouerose I think what you are looking for is this: https://clojurescript.org/reference/javascript-module-support
native support of js modules in clojurescript. I guess that would include rn modules since it is just a semantic transformation. Of course you would still need to call r/adapt-react-class
but that is another history 😉
@carocad check this out https://github.com/dmotz/natal-shell
Nice ! If I understand that right, he is also getting the documentation of the components? Did you try it?
Hey all, using re-natal, how d'you make parametrized builds? I mean, depending on the profile (dev/prod), I'd like to add other configs to the application. I haven't found a good way to do so yet - it should be added at build-time, so probably a macro or so?
Ideally, it would read a config file (so I don't have to set all config in separate system properties) - at compile time, of course.
so, if I add :closure-defines
to defproject
:
:profiles {:dev {:dependencies [[figwheel-sidecar "0.5.8"]
[com.cemerick/piggieback "0.2.1"]]
:source-paths ["src" "env/dev"]
:cljsbuild
{:builds [{:id "ios"
< ... >}}
{:id "android"
< ... >
:compiler {:output-to "target/android/not-used.js"
:main "env.android.main"
:output-dir "target/android"
:optimizations :none
:closure-defines {conf "from project.clj"}}}]}
I'd expect that the output of (goog-define conf "from code")
would set conf
to from project.clj
. It doesn't. It shows from code
.
(defn init []
(goog-define conf "from code")
(.log js/console conf)
(mount-app)
(.registerComponent < ... >)
Why is that? (Or maybe I should ask on #leiningen ? Or on #clojurescript )@carocad I have not tried it yet but it is on my list. I also saw this https://github.com/artemyarulin/ktoa
do we have a sort of cljs rn library register? it seems like there is tons of stuff to try out and lots of development going on but (at least I) it gets missed somehow 😞
@kurt-o-sys maybe you mean something like this: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L278 ?
@carocad I would be interested in knowing what you think of the natal-shell especially whether you think it fits re-natal
@pesterhazy you too 🙂 when you have some time, check it out, would like to know what you think
@vikeri: I think the tabs are working well. I have an example you can download and run if you wanna check it out.