Fork me on GitHub
Oliver George01:05:47

@mfikes do you think the re-natal template should use :target :nodejs as per your blog post?

Oliver George01:05:02

(e.g. is it stable/safe?)

Oliver George01:05:30

Anyone using Google's Fastlane with cljsrn?


@olivergeorge The stuff in that blog post is stable / safe, as far as I can tell. (It is not based on some quirk of the compiler that may go away in the future.) I suspect if the metro bundler vs. :npm-deps nut is ever cracked then we may end up consuming third-party components this way as well. But in the meanwhile, I see no issue with code being constructed this way, even in templates. I have changed my opinion on constructs like rn/Animated.View mentioned at the bottom of that post, but that's really a separate subject.

Oliver George11:05:46

Turns out re-natal require-all won't discover the require statements in this format.

Oliver George01:05:41

Thanks for clarifying


As an aside, without the patch in, I've been strongly motivated to avoid having the compiler know about stuff in node_modules, setting :npm-deps false.


(I suspect if you set :npm-deps false then the stuff in that blog post won't work.)

Oliver George02:05:52

I'll keep that in mind. Haven't come across the "metro bundler vs. :npm-deps nut".

Oliver George02:05:16

Perhaps that's why the re-natal project.clj file doesn't use :npm-deps at the moment


@olivergeorge When React Native first appeared, David Nolen's inclination was to avoid the bundler, and he drafted a Remote Compilation architecture back in Feburary 2015 We roughly had things working with Ambly this way and managed to get ClojureScript running with React Native


But, this was constantly going against the grain, by essentially ignoring the metro bundler (it was called the React Native packager back then). It took the bulk output of the bundler, and then concatenated ClojureScript's output onto that, and then mutated that via the REPL.


This this an early demo of things working that way


That stuff was manually cobbled together, and Dan Motzenbecker put together a system to automate it: natal:


Then Will Decker figured out a way that worked with the packager and with Figwheel


And then Artur Girenko ran with that approach, taking natal and Will's approach to create re-natal that we know today.

Oliver George02:05:48

I had wondered about that.


The Metro Bundler is great. The Metro Bundler is a royal pain in the ass.


TL;DR, it exists to help React Native work for conventional JavaScript dev, but it doesn't mesh well with the way ClojureScript wants to work with its compilation model.


Maybe Thomas Heller can figure out a way to make things jive with Shadow Cljs, perhaps coming up with a more natural approach.


So, you will often hear this as "embrace or reject the bundler" sentiment

Oliver George02:05:25

Thanks for the brain dump.

Oliver George02:05:46

So looking ahead to an "ideal" approach without the bundler we need to do it all in a clojure build step

Oliver George02:05:54

Package fetching (:npm-deps)

Oliver George02:05:06

Compiling with pre-processors (not impossible)


Yeah, if we had enough time, and were sufficiently clever, we could achieve a clean solution that feels more like React for the web


It is truly a fascinating challenge, with some deep technical issues to be resolved, and it is not even clear if they can all be resolved


Given the sheer difficulty with all of this, my stance has been to essentially drop everything and try to put any energy into getting re-natal to work, even if it is at a "local optimum" and not the long-term best approach. It's the best thing we currently have going.

Oliver George02:05:57

That'd make a good "trade-off's" section for re-natal. Perhaps including "what would need to change" to move away from local-optimum


Cool thing is, we're all producing bona fide production apps with this stack now. 😎

Oliver George02:05:27

Seems a lot better than I remember a year or so ago. Less rough edges.


Oh yeah, I had even gone down the road of when there was no RN in sight yet. 🙂


We are in a much better place now.


This is still one of my favorite tweets on that subject


PSA: I had upgraded to Node 10 and started getting bundler errors around fs-events. Going back to 9.11.1 resolved this.


I've been pondering using re-frame effects to manage React Native animations. Anyone had any good / bad experiences with this?


I'm interested in this. At the moment i keep react native animations in the view layer but it can get a bit verbose. And tricky when the animations get more complex and interdependent


What did you have in mind


Not much more than somehow setting up some effects to act upon animated values. I'm still exploring how to do this, with a hope that the end result works well with re-frame


I did toy with storing animated values in the reframe db and used effects to drive them


But I worried about the inner platform effect - that I might end up trying to recreate the whole animated api as data


At the moment I kind of compromise and keep the values in an Atom outside of reframe but that I can access from an effect if needs be


But not got anything Im super happy with


Here is a version of the core of @olivergeorge’s AsyncStorage stuff that is written without that intermediate lib (which evidently converts things to promises):

👍 4
Oliver George22:05:48

Nice @mfikes. I wonder when something like react-native-storage would shine. Anyway, for now I've taken your gist as a better approach.

Oliver George22:05:37

I here by formally acknowledge one of my weaknesses is talking things up and not following through. With that caveat I have a suggestion... how about a series of gists covering each of these specific concerns. @mfikes you talked about a library of these code chunks. It could complement that or really just allow a copy & paste version to the same end.

Oliver George22:05:13

I'm trying to do this for my dev team who will be working on their first react native app. They do clojurescript daily but there's still lots to get across before you can stop believing in magic.

Oliver George22:05:25

Here's the list of blog posts I've got at the moment for them... Compiling with :target :nodejs Helpful interceptors Tradeoffs: Embrace or reject the bundler Gotcha #3: I see dead people Gotcha #2: Forgetting to restart the Metro Bundler Navigating between scenes Storing data in the app Store listing details (Google Play Console) Tour of the Azure AD configuration and management Gotcha #1: Forgetting to regenerate index.*.js Authenticating against Azure AD One-off setup of React Native Bindings for the Microsoft ADAL library Figwheel used for REPL and live coding Setup needed to Generate Signed APKs iOS Podfiles


I wouldn't mind creating a lib that is essentially -fx for React Native


Maybe I'll do that... do you mind if I use some content from your gists @olivergeorge?

Oliver George22:05:33

I'd be happy to point at it from those posts.


I'm thinking that a storage, and a fetch FX would be in that lib initially.


I'll put something together... I think these would be generally useful for devs writing RN apps with re-frame

Oliver George22:05:39

I'll post some more of my notes on gist and perhaps that'll inspire a few more additions.

Oliver George22:05:25

This is the most intrusive / least fx related post I have... navigation

Oliver George22:05:35

I don't have much experience so would love feedback.