Fork me on GitHub
#cljsrn
<
2018-05-07
>
Oliver George01:05:47

@mfikes do you think the re-natal template should use :target :nodejs as per your blog post? http://blog.fikesfarm.com/posts/2017-07-17-cleaner-clojurescript-react-native-interop.html

Oliver George01:05:02

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

Oliver George01:05:30

Anyone using Google's Fastlane with cljsrn? https://docs.fastlane.tools/#why-fastlane

mfikes01:05:29

@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

mfikes01:05:30

As an aside, without the patch in https://dev.clojure.org/jira/browse/CLJS-2739, I've been strongly motivated to avoid having the compiler know about stuff in node_modules, setting :npm-deps false.

mfikes01:05:05

(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

mfikes02:05:40

@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 https://github.com/mfikes/ambly/wiki/Remote-Compilation We roughly had things working with Ambly this way and managed to get ClojureScript running with React Native

mfikes02:05:41

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.

mfikes02:05:06

This this an early demo of things working that way https://www.youtube.com/watch?v=Dt2zNemLCCk

mfikes02:05:07

That stuff was manually cobbled together, and Dan Motzenbecker put together a system to automate it: natal: https://github.com/dmotz/natal

mfikes02:05:28

Then Will Decker figured out a way that worked with the packager and with Figwheel https://github.com/decker405/figwheel-react-native

mfikes02:05:18

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.

mfikes02:05:10

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

mfikes02:05:07

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.

mfikes02:05:11

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

mfikes02:05:50

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)

mfikes02:05:30

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

mfikes02:05:17

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

mfikes02:05:47

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

mfikes02:05:05

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.

mfikes02:05:14

Oh yeah, I had even gone down the road of https://github.com/mfikes/goby when there was no RN in sight yet. 🙂

mfikes02:05:34

We are in a much better place now.

mfikes02:05:33

This is still one of my favorite tweets on that subject https://twitter.com/andy_matuschak/status/560511204867575808?lang=en

mfikes12:05:57

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

mfikes12:05:31

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

danielneal14:05:38

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

danielneal14:05:46

What did you have in mind

mfikes14:05:28

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

danielneal14:05:54

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

danielneal14:05:52

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

danielneal14:05:31

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

danielneal14:05:43

But not got anything Im super happy with

mfikes19:05:08

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): https://gist.github.com/mfikes/4ac767c0de05cc127a42c14707723ec4

👍 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

mfikes22:05:58

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

mfikes22:05:37

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.

mfikes22:05:56

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

mfikes22:05:48

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.