Fork me on GitHub
#cljsrn
<
2021-09-02
>
kennytilton11:09:29

I see some work has been done on https://github.com/PEZ/rn-rf-shadow and specifically Cursive. Looks good! deps.edn is gone (my fault? :)) so we have a different way of setting up the project, but then we have

Select the REPL by pressing Run > Edit Configurations and selecting Clojure REPL > REPL
...but that shows Error running REPL: REPL run configuration is incorrect - no module selected. When we edit the configuration we see
Run Configuration Error: No modules containing clojure.main found
Could not figure out a way to set up a repl, without dragging in the deps.edn from an earlier clone of this repo. Did I miss a crucial step? @pez Congrats overall on the good detailed doc, esp. guiding folks around IntelliJ.

pez13:09:40

Yes, you were the one that pointed me at that deps.edn file. 😃 I didn’t know it was instrumental to make the Cursive instructions to work. I should probably have thought about that… Anyway, according to these instructions, it seems to be quite straight-forward to set up Cursive for a shadow-cljs project. https://gist.github.com/akovantsev/44e2a0e10908785d1f40d3d3bcfff574 Do they work for you?

kennytilton18:09:28

Thx for the link, @pez. I will give those instructions a try and report back. Right now I have Krell at bat and raw Shadow on deck, then back to rn-rf just to confirm those instructions.

pez19:09:02

Awesome. A PR is if course welcome.

dnolen12:09:45

@hiskennyness to be clear Cursive integration is trivial if you just use a plain REPL with deps.edn - no special instructions are required

dnolen12:09:07

which would be true for Figwheel too

kennytilton13:09:28

Thx, @dnolen. I'll see what @pez says. Now I am looking at Krell... 🙂 fig:main was great because it took a react native-generated project, added a bit of code (no Reagent!), and shazaam, I was working! Then I got to the require thing you sorted out for me, upgraded my cljs version, and the damn project refuse to run! 😭 My current thrash-list of candidates: • Krell; • a Helix project (no Reagent!) with Helix ripped out ; • back to fig:main and try not to trash everything. I think I am just going thru basic training: • Helix showed me how to do RN absent Reagent; • That got me going on integrating Matrix with RN, during which I learned a bit of RN; • I think now I am going to school on the build process. All good and reasonable if I want to ship a framework. Thx again for the help. 🙏

dnolen13:09:30

Krell doesn't dictate anything about how you intend to use React Native - the tutorial uses Reagent because it's popular

dnolen13:09:03

FWIW, I find reading repo docs entirely too tiresome

dnolen13:09:20

Everytime I see some instruction on how to use X with Y - I think - what the heck happened?

dnolen13:09:39

The instructions for X should be sufficient to use w/ any Y and they should be concise

dnolen13:09:49

Krell's whole philosophy is that RN is well documented, you already know how to use plain ClojureScript

dnolen13:09:54

there are no other steps

kennytilton16:09:20

Working the Krell example now. I'll let you know if I find any steps. 🙂 The thing is, when I started this deep dive I knew nothing even about RN. So looking at even a simple tutorial like the Krell reagent example gave me the sweats: if I rip out Reagent, how do I get back to RN? And what does it look like to code RN via CLJS interop even if I could. Helix got me to "life without Reagent/re-frame" hurdle, then the figwheel roll-your-own example got me to "straight CLJS+RN". Now I am ready for a process with no steps, such as Krell. 🤞

thheller16:09:28

I have an example using only plain react, no CLJS wrapper at all if you are interested https://github.com/thheller/shadow-cljs/blob/master/src/dev/demo/rn.cljs

thheller16:09:54

meaning the root fn, don't have to use the shadow.react-native/render-root helper. that just exists to make hot-reload easier

kennytilton17:09:57

Diabolical, @U05224H0W, hiding that in the Shadow repo itself! :rolling_on_the_floor_laughing: Thx! Exactly for what I was looking! I'll finish up my Krell exploration then give that a try. The boss loves Shadow but he's afraid of Matrix, any warm fuzzies I can give him (even as a fallback) will help.

thheller18:09:35

note the js/require stuff is entirely optional. just testing the code-splitting stuff, no needed in most cases

thheller18:09:47

as far as the react/createElement stuff is concerned that should work everywhere

dnolen18:09:41

@hiskennyness I would just try Helix w/ Krell - if that's what you want to do

kennytilton18:09:53

tbh, Helix+RN got me so close to RN that I started wondering if I could peel that layer away as well. Then the Helix+RN samples, shipped with RN .60sth, proved a problem -- I wanted Pressable released in 0.63 -- and the build failed if I dropped in newer projects genned for later RNs. I could not even drop in a fresh-genned .60 to get back, suggesting @aiba had worked some black belt magic on the embedded RN projects. (He's working on upgrades now.) That's when I jumped to figmain, and saw I could indeed Just Call createElement, and I was liberated. MatrixRN will not have any dependency on even the lightweight Helix, and if I can get Krell "It does only one thing" going, that would be perfect for a MatrixRN release. Then I'll do a Shadow-driven "hello world" to suck in the boss, and a fig:main for those that roll that way. CLJS build tools are my new thing! 🙂

dnolen18:09:06

@hiskennyness Krell does not have the React version problem because we don't try to do anything about it

dnolen18:09:59

you could do what we do is just write React Native JS - and build your app in CLJS

dnolen18:09:20

in our case Reagent is mostly a interop sugar

kennytilton18:09:50

My experience with Matrix, going back to when it was a Common Lisp server app pushing qooxdoo.js to the client, was that I could "paint" UIs so fast that sth like StoryBoard-first would actually be a slower workflow. But I grok that part of your solution is "devs don't need CLJS", which Matrix would not achieve. We did follow your lead and give SB a look. We could not get the SB web interface working in the native variant, so we are looking at DraftBit for prototyping (in case we end up on re-frame). @dnolen

dnolen19:09:59

Hrm you don’t need web variant for SB though IMO - you want to do the component dev in simulator or device

dnolen19:09:30

RN refresh is sufficient for pure component dev IMO

kennytilton19:09:37

Ok, thx, I was wondering if you all had gotten the web variant working. The dev who explored SB did like it. I think he mocked MQTT with a "story" at one point. Fun stuff. Did you look at DraftBit at all? @dnolen

kennytilton20:09:35

New Reagent-free Krell tutorial:

(ns awesome-project.core
  (:require [react]
            [react-native :as rn]))

(def <> react/createElement)

(defn hello []
  (<> rn/View
      #js {:style #js {:backgroundColor "#FFFFFF"
                       :flex 1
                       :justifyContent "center"}}
      (<> rn/Text
          #js {:style #js {:color "black"
                           :textAlign "center"}}
          (str "Hello, world."))))

(defn ^:export -main [& args]
  (hello))
Thx for the encouragement! @dnolen